-
Notifications
You must be signed in to change notification settings - Fork 554
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
Exclusive Convey #52
Comments
@joliver - As I see it right now, the only thing we could do with certainty is ignore all other |
@mdwhatcott Agreed. Only within the same story and all sub-conveys within the marked/exclusive convey would be run. |
@joliver lets back up and ask the question "why do we sometimes want to run a single scope?" Is it usually to limit output because of all the repeated/isolated test runs? If so, I've discovered that the log package can be used for debug output really effectively, such that ioutil.Discard is used as the writer (noop), except for the scope in question, which could make use of os.Stdout. |
Sometimes I single out a scope so I can try debugging the application code
|
@joliver Yes and usually the debugging consists of a few scattered print statements. The output of those print statements tends to multiply when lots of Conveys are executing the same production code over and over, hence the need to isolate a particular Convey. The solution I'm thinking about allows the tester the ability to turn output on and off for selected Convey scopes but doesn't necessarily skip any Conveys. This solution would be convenient because it doesn't require any change to GoConvey, just skilled usage of the log package or even the fmt package to redirect/select output as needed. |
Here's an example of using the log package to select/filter output. Notice that we set all logging to be discarded near or at the top-level Convey. Then, deeper in we set the log outptut to be a valid writer (like os.Stdout) and only get the output you need. The downside is that you have to mess with importing "log", "os", and "ioutil" in your test code if you don't have them already. And it means that you use "log" instead of "fmt" in your production code (which isn't really a downside, just an observation).
|
This could work unless we start using gdb in which case we'd be able to set On Fri, Nov 8, 2013 at 10:34 AM, Michael Whatcott
|
Yes, good point. I'll continue thinking about how to go about this. The log workaround will help for now though (I think). |
Not quite sure how to go about this yet so we are deferring this issue. It will be referenced on the wiki for future discussion. |
@joliver - Well, I'm a bit embarrassed at how simple the solution was and how long it took me to come up with. The only slight change is that you have to start by calling |
Hey, this (quite old) feature is what I was looking for! It would be great if it was documented in the Wiki so other people can find it faster 😄 |
The wiki is open for editing--feel free to create a page if you'd like. @danielalves |
👍 |
Added a basic summary and usage example to the wiki: https://github.com/smartystreets/goconvey/wiki/Skip#running-only-certain-convey-registrations |
Is it not possible to have just a single deep FocusConvey, similar to the way jasmine allows a Having to change all conveys up the tree doesn't really allow to quickly run a single problematic test case. |
Could you please add the ability the run only a specific convey? This would eliminate the need to use SkipConvey on other sections. Perhaps it could be called OnlyConvey or something similar.
The text was updated successfully, but these errors were encountered: