Hi,
in our tests, we sometimes just want to run a subset of our tests.
Some of the tests should not be run at all, some other tests should only be run on a smaller set of files (found in a directory).
Right now, we’re using a mixture of both categories and a configuration setting in app.config.
It would ease our lives a little if we could query which categories have been selected prior to running a test.
Does Nunit expose this information?
Thanks
Michael Schnick
Michael Schnick, Cognex Ltd, Germany
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.
>
thanks for the prompt feedback.
What I'd like to do is in fact using batch runs.
Either with a batch run or with the NUnit GUI, I'd like to include categories and the run the tests.
For us, it would be enough to get the list of selected categories exposed through a list or an Array, just like
String [] NUnit.SelectedCategories(), listing all the categories as single items that have been included.
Do you think this is feasible?
-Michael
-----Original Message-----
From: nunit-...@googlegroups.com [mailto:nunit-...@googlegroups.com] On Behalf Of Charlie Poole
Sent: Donnerstag, 16. Dezember 2010 18:50
To: nunit-...@googlegroups.com
Subject: Re: [nunit-discuss] query selected categories?
Yes it's feasible. The currently selected categories could be made
available as a
part of the TestContext - for example, TestContext.SelectedCategories.
To understand and prioritize this better, can you explain a bit more how you
would use it? I'm still not completely understanding what you want to do
with it. Maybe a bit of pseudocode would help...
Charlie
On Fri, Dec 17, 2010 at 12:36 AM, Schnick, Michael
this sounds great.
Here's what I'd do:
[Test]
[Category("long")]
[Category("short")]
Public void SomeTest()
{
List.Add(item1);
List.Add(item2);
If(TestContext.SelectedCategories.Contains("long"))
{
List.Add(item3);
List.Add(item4);
...
List.Add(itemN);
}
ProcessList(List);
}
Depending on the content of the list, this test might either take an hour (full scope) or 2 minutes (reduced scope).
So, for our short tests where the results need to be available ASAP, we'd like to make sure that we're using the correct number of items here.
Thanks
Please make a feature request for this at http://bugs.launchpad.net/nunitv2
so we can track it for 2.6.
Charlie
On Mon, Dec 20, 2010 at 1:36 AM, Schnick, Michael