-
-
Notifications
You must be signed in to change notification settings - Fork 666
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
Feature requests: more structured tests and names for Ginkgo #144
Comments
I'm trying to come up with a way to express this that is backwards compatible and not ugly. The best I can come up with is something like: Describe("User Propagation", func() {
BeforeEach(func() {
...
})
It("should do something", func() {
Ω(...).Should(...)
})
It("should do something else", func() {
Ω(...).Should(...)
}).Label("slow")
Context("when connected to the internet", func() {
It("should do something special", func() {
Ω(...).Should(...)
})
It("should do something expensive", func() {
Ω(...).Should(...)
}).Label("slow")
}).Label("requires-internet")
}).Label("complex") Then the CLI would support:
(this runs all tests that don't have the "requires-internet" and "slow" labels)
(this runs all tests that have "requires-internet" and not "slow") - etc... I'd then update the default report to include tag information when running in verbose mode. You'd also be able to mix in The only thing about this I don't like is that Alternatives could look like:
Or
But those strike me as ugly... Any thoughts? |
ping? any thoughts on this approach? |
I like this proposal. It allows you to more easily select a set of test cases to run and more importantly allow you to filter tests you don't want. Unless I'm missing something, one of the missing test selections in ginkgo is the ability to have a test in a suite but not have it run by default. The only way I see to handle that is to make the test/suite Pending, but that then involves manually changing the file to allow it to run. I don't see a way to say "run the suite except for these tests" from the command line. You could focus on the exact tests you want, but really I'm wanting to exclude tests. This proposal provides nice tags you can mix and match and better control which tests are run. Would you allow multiple label definitions per test/suite? Something like: Describe("User Propagation", func() { }).Label("slow", "network", "performance") I also dislike the labels being at the end, but I think they look cleaner then the proposed pre-fix options. |
It sounds like you actually want to have separate test suites. Wanting a single test suite to represent two or three different classes/kinds of test is an anti-pattern (though it can be accomplished with the proposed
Pendings are meant to convey tests that are currently failing but that are meant to be fixed in the near-future. I'll often write a failing spec for a bug and mark it Pending until I can resolve the bug. You are right, it's not meant to select subsets of the test dynamically.
You can user I often use this as follows:
When I run the tests locally I just Because of this flexibility I haven't needed the proposed |
Not intending to drag my feet on this. It sounds like there was a bit of confusion as to what Ginkgo gives you out of the box. In light of my previous post describing |
Sorry for the delay, I was on vacation for a couple of weeks. I'm not really sure we can find a good enough way to introduce this feature given the current constraints... At this point I think my better suggestion is to keep this one in mind so that if at some point you decide to change the API (maybe on a Otherwise, I kind of agree that using So I'm leaning towards closing this one and will do so... If anyone disagrees, please feel free to reopen it. Cheers, |
We've been tagging our tests using "[tag]" in the name for a while now, which basically seems to work, but it interacts poorly with the JUnit reporter and CI systems - every time we add or remove the tag, we lose any history for that test, since the name is now different. Do you have any suggestion for how we might approach this? One idea was passing some sort of regular expression to the JUnit reporter, which it would then use to strip tags from the name saved in the JUnit XML report, though that seems a little hacky. |
I'd like to use the mac:~ jianzhang$ ginkgo version
Ginkgo Version 1.6.0 |
As referenced in kubernetes/kubernetes#3837, it would be nice to be able to have a more structured way to associate tags or a name with specific tests, in case we only want to run a subset of the tests or a single test.
Maybe make it more structured as a []string or add a new "verb" (like
Describe
,It
etc.) that you could use to associate tags to existing tests?Ideally a unique name, though if we have tags we can always use
name=TestThisAndThat
which is unique enough...@onsi @rrati @timothysc @zmerlynn @roberthbailey @satnam6502 @lavalamp
The text was updated successfully, but these errors were encountered: