Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequence #23

Closed
stephanos opened this issue Dec 15, 2013 · 6 comments
Closed

Sequence #23

stephanos opened this issue Dec 15, 2013 · 6 comments

Comments

@stephanos
Copy link
Contributor

I have a rather long spec that I had to split up into multiple It steps for readability and maintainability. But since each step depends on the success of the previous one it's rather annoying to go through dozens of failed tests to get to the root cause.

So a Sequence could be a special kind of Description that stops the execution of its Its as soon as the first one fails.

What do you think?

@onsi
Copy link
Owner

onsi commented Dec 15, 2013

Hmm.. Its are meant to be independent of one-another. That way they can (and are if you -randomizeAllSpecs) be shuffled. this also helps avoid test pollution. I'd rather avoid breaking the It semantics if possible.

Can you point me to some example code so I can look at and think about your use case more? Long Its can be a smell, but sometimes (especially in integration style tests) one ends up with long Its. I usually annotate them into sections with comments..

@stephanos
Copy link
Contributor Author

I understand. Personally I find it easier to have a test "count entites" fail instead of "datastore queries".

My project is not open source yet, but I have created a gist to illustrate my integration test. It's a Go library to add a higher-level API to the App Engine high-replication datastore (HRD) (note that "101loops/bdd" wraps ginkgo/gomega and adds helper functions / uses slightly different syntax).

@onsi
Copy link
Owner

onsi commented Dec 15, 2013

I took a close look at your tests and have a few suggestions. I don't think this is one large It -- it really is a series of small Its with shared setup.

Rather than try to explain what I mean, I've rewritten the query test to illustrate how shared setup can be implemented with BeforeEach and a bit more nesting. I've switched to Describe and Context, though Sequence and With still work of course.

Take a look and let me know if things make/don't make sense.

@onsi
Copy link
Owner

onsi commented Dec 15, 2013

Oops here's the gist:

https://gist.github.com/onsi/7978758

@stephanos
Copy link
Contributor Author

Hey, thanks for taking the time! I like your approach, it makes total sense. I will definitely apply it to this suite and upcoming ones.

By the way: thanks for the great test runner and test matcher! :)

@onsi
Copy link
Owner

onsi commented Dec 15, 2013

Glad to help! Am always looking for feedback on Ginkgo and Gomega and I think it's cool that you've been able to wrap the library to map it onto semantics that you prefer :)

xjh1996 pushed a commit to xjh1996/ginkgo that referenced this issue Jan 12, 2021
* bugfix: loadconfig (onsi#17)

feature: add tenant to request

* WIP:add auth demo

* optimize case structure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants