I've had some discussions with the submitter of this bug...
https://bugs.launchpad.net/nunit-3.0/+bug/730891
about various ways of stopping the test run on first failure.
Rather than discussing different implementations and syntaxes
for doing it, I thought we should discuss the following question:
"Is it reasonable to permit a test to signal that the test run
should be completely abandoned?"
I can see several reasonable ways of designating certain
failures as "Fatal" provided we think it's
1) Useful to at least some people
2) Not dangerous to the general user
Charlie
--
You received this message because you are subscribed to the Google Groups "NUnit-Discuss" group.
To post to this group, send email to nunit-...@googlegroups.com.
To unsubscribe from this group, send email to nunit-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nunit-discuss?hl=en.
Any setup (i.e. SetUp, TestFixtureSetUp or SetUpFixture SetUp method) will
cause the tests under it's control to be abandoned. They are not run, although
they may appear to because they show up as red in the Gui and are counted
as failing test cases in the summary report.
I'm not sure if the requestor's use case can be translated into some sort
of setup check. That might be worth exploring.
Charlie
> --
> You received this message because you are subscribed to the Google Groups "NUnit-Discuss" group.
> To post to this group, send email to nunit-...@googlegroups.com.
> To unsubscribe from this group, send email to nunit-discus...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nunit-discuss?hl=en.
>
>
--
Le doute n'est pas une condition agréable, mais la certitude est absurde.
Take a look at ADPlus configs here
http://msdn.microsoft.com/en-us/magazine/cc163833.aspx
Would this be a better way of handling this use case?
Charlie
On Wed, Jul 27, 2011 at 9:39 PM, Nicolas Rivera <nick4...@hotmail.com> wrote:
> Not sure I follow what you mean. I am not running tests in parallel, thus
> there is only one pending TearDown at a time (at least from my point of
> view, I don't know how the tool is implemented).
Let's say you have a test case that fails. There are potentially multiple
TearDown methods that need to be run in the same class or in its base
classes. In addition, the class and base classes could have multiple
TestFixtureTearDowns and any of the enclosing namespaces might
have SetUpFixtures with TearDowns.
That doesn't even account for pending After actions needing to be completed
due to action attributes in NUnit 2.6.
For a clean shutdown, they must all run.
> I do want to stop when a unit test fails, and in this case, I don't even
> want to run the TearDown upon failure (I don't want to cleanup). You are
> correct that in my original request the TearDown would have been executed
> for the unit test that failed, so it wouldn't have been as ideal. But given
> that my original request was in the context of analyzing a log, it still
> would have been better stopping after TearDown upon failure, than not
> stopping at all. It is difficult to analyze a verbose log and try to find
> in it where the test failed, when 20 other tests have already been executed
> after the failure.
Perhaps we are using the word "stop" differently. I'm taking it to me "end the
test run gracefully, performing any needed cleanup" which is what it has
meant in some other pending requests. I see that you want to freeze
the action in a way that allows you to debug things. Perhaps we need
another word to communicate that.
>
> I am aware there are workarounds. I wrote some of them in the link you
> posted. And I can come up with other ways to make my task easier.
>
> I don't know what makes a feature worth having in your mind, hence I am not
> sure I can be of much more help to you. It depends on what you think the
> level of effort should be for a developer to use NUnit (should a developer
> be looking for workarounds for these type of requests?), who are your target
> users (TDD users or a wider group?), how difficult would it be to implement
> the feature, what is your vision for NUnit, etc.
It's more a question of what the feature needs to do and what might be
the best way for the program to express it. We need a clear way to talk
about what it is first off: "stop" was confusing me at any rate. Secondly,
do we want to have NUnit initiate dumps, etc. for you or merely give
you a way to do those things manually by pausing before terminating
the app.
Charlie
> Thanks,
>
> Nick
>
> On 7/27/2011 9:22 PM, Charlie Poole wrote:
>
> So really, with regard to your original request to _stop_ the gui, that
> would
> not actually help you. Any facility to stop the remaining tests would
> have to run all the pending teardowns first, else their wouldn't be a
> proper shutdown.
>
> Charlie
>
> It's more a question of what the feature needs to do and what might be
> the best way for the program to express it. We need a clear way to
> talk about what it is first off: "stop" was confusing me at any rate.
> Secondly, do we want to have NUnit initiate dumps, etc. for you or
> merely give you a way to do those things manually by pausing before
> terminating the app.
Personally I wasn't thinking of NUnit initiating dumps, etc. It seems
out of scope. At any rate, I wasn't expecting it. What I was expecting
was for the tool to make it easy for me to do those things if I wanted
to -- but not to actually do them for me.
Being a developer, what I would find most flexible/extensible, would be
if the tool provided a programmatic way to abort/terminate the execution
of a batch of tests at any point. That, plus good support of
TestContext (which allows one to know if the test actually failed),
would probably be enough to deal with just about any similar type of
scenario without having to come up with custom workarounds -- and
without having to go back to you with another variation of the same request.
Just my two cents for what is worth.
Thanks,
Nick
What if we had a method like 'Wait' or 'Pause'?
I do something like this myself when I need to debug nunit-agent.exe. I insert
a MessageBox call that says "Attach to nunit-agent and press OK"
A more general implementation of this might work like this...
1. Test or Setup or Teardown issues TestContext.Wait("message"). A variant
would be to use Assert.Wait("message");
2. NUnit uses it's normal event/progress channel to send a Wait event.
3. The runner takes action on the wait.
3.1 For the Gui a message box is used
3.2 For the console runner pause message is used
Of course, you would have to avoid using Wait() if running unattended.
We could give nunit-console an option to indicate that no pausing is
allowed and it would then be ignored.
Another possibility is to allow various action choices like
* Continue the run
* Stop the run after this test
* Stop immediately without any further cleanup.
But that could be added later.
How does that sound?
Charlie
Sounds pretty good to me.
I also like your idea of having a way to tell the console or GUI whether
pausing is allowed or not. Right now I am using the existence of a file
with a particular name to accomplish the same thing. But if the tool
itself had that setting, it would be one less workaround (albeit a
rather trivial one).
Thanks,
Nick
Charlie
On Thu, Jul 28, 2011 at 11:28 AM, Nicolas Rivera