Questions tagged [ginkgo]

Ginkgo is a BDD-style Golang testing framework built to help you efficiently write expressive and comprehensive tests.

About

Ginkgo is a BDD-style Golang testing framework built to help you efficiently write expressive and comprehensive tests. It is best paired with the Gomega matcher library but is designed to be matcher-agnostic.

Links

67 questions
14
votes
1 answer

How can I debug Ginkgo tests in VS Code?

I'm evaluating ginkgo at the moment - I very much like the BDD style. However I'm unable at the moment to get the VS Code debugger to work with the framework. The official VS-Code extension provides test-by-test debugging for native go tests using…
bighairdave
  • 592
  • 5
  • 19
6
votes
2 answers

Testing Stdout with go and ginkgo

here I am making my first steps in go trying to do BDD on a go command line app. I am using Ginkgo, which wraps testing.go and lets you do more expressive BDD. https://github.com/onsi/ginkgo I am having issues in reading the stdout to do an…
bonzofenix
  • 635
  • 5
  • 12
5
votes
1 answer

Unable to run ginkgo bootstrap command on mac

When I run this command ginkgo bootstrap I am getting this error zsh: command not found: ginkgo I have already installed ginkgo using the following command go get -u github.com/onsi/ginkgo/ginkgo I am unable to understand what I am doing…
Usman Sajid
  • 181
  • 2
  • 11
5
votes
2 answers

Disable Ginkgo warning of "slow test"

I am using Ginkgo to execute some relatively long-running integration tests. Interspersed with my test output is the occasional warning that my tests are taking too long to execute: • [SLOW TEST:30.000 seconds] Is there a way to disable these…
Henrik Aasted Sørensen
  • 6,966
  • 11
  • 51
  • 60
5
votes
2 answers

Running Ginkgo test suite (BeforeSuite setup before any spec is ran

I am experiencing with Ginkgo (and Gomega) packages for unit testing Go(lang) Rest API. I need to use global setup which should be achievable by defining var _ = BeforeSuite(func() {...}) Then each spec (concrete _test.go) should run after…
shadyyx
  • 15,825
  • 6
  • 60
  • 95
4
votes
1 answer

kubernetes Operator-sdk test with envTest

I am a newbie for operator-sdk. Now I am writing test for operator with envtest framework, so I had a fake control-plane for environments. Inside controller reconcile loop, once I initialize a CR, then controller will pull down an image for pod and…
Joe
  • 623
  • 7
  • 16
4
votes
3 answers

Ginkgo tests not being found?

I do not understand why 'go' cannot find my Ginkgo test files Here's how my structure looks: events ├── button_not_shown_event.go ├── events_test │ └── button_not_shown_event_test.go And here how my button_not_shown_event_test.go look…
Viren
  • 5,812
  • 6
  • 45
  • 98
4
votes
3 answers

How do I set up a Ginkgo test suite?

I have inherited a Go project that consists of a lot of common files, a library of sorts, two executables, and theoretically a test suite. The test suite is being written after the fact. But I dislike the only way I've found of setting up is…
Savanni D'Gerinel
  • 2,379
  • 17
  • 27
3
votes
1 answer

Ginkgo/Gomega Panic Test Fails

I'm writing a test to assert that a function panics on invalid input, but Ginkgo records the panic as a failure instead of a passing result as expected. func ParseUnixTimeString(unixTimeString string) time.Time { i, err :=…
frederix
  • 1,662
  • 5
  • 18
  • 29
3
votes
1 answer

how to run a single spec using ginkgo test framework

./I have a test suite that has 4 specs, like this: var _ = Describe("Start a Cycle", func() { It("test 1", func() {...}) It("test 2", func() {...}) It("test 3", func() {...}) It("test 4", func() {...}) }) I would like to run only "test 1" ,…
jliao
  • 121
  • 1
  • 7
3
votes
3 answers

when defer func is executed at ginkgo

I'm rewriting unit test of our k8s controller with ginkgo. As previous TDD, for each test, we will have something like. // Create the Channel object and expect the Reconcile g.Expect(c.Create(context.TODO(),…
Ian Zhang
  • 402
  • 3
  • 17
3
votes
1 answer

Mocking NewConsumer in sarama-cluster

Is there a way to test/mock sarama-cluster's NewConsumer function without having actual brokers set up? What am I missing here? Code I'm trying to test: import cluster "github.com/bsm/sarama-cluster" func initSaramaConsumer() (*cluster.Consumer,…
ntfx
  • 113
  • 7
2
votes
1 answer

How to output the test command Ginkgo uses

I have a Ginkgo test suite that has many test files. I can run all tests under the test suite with the following command, where ./controller is the package that has all tests. go test ./controllers/... -v --args --ginkgo.vv say ./controller folder…
Mike
  • 1,841
  • 2
  • 18
  • 34
2
votes
1 answer

Using ginkgo with different go versions

I'm using go with multiple version as stated in this doc https://go.dev/doc/manage-install go install golang.org/dl/go1.10.7@latest go1.10.7 download And I'm also using ginkgo, which I installed like this: (based on…
Eric
  • 5,686
  • 2
  • 23
  • 36
2
votes
1 answer

Can Gomega support verification of multiple return values of different types where the last one is not `error`?

For instance: If I have a wrapper for https://pkg.go.dev/sync#Map.Load: with the same method signature: func Load(key string) (value interface{}, ok bool) in Can Gomega's Equal() handle multiple values ? similar question was asked and the response…
user892960
  • 309
  • 2
  • 11
1
2 3 4 5