ITestAssemblyRunner - dictionary of settings in Load()

31 views
Skip to first unread message

Joseph Wang

unread,
Oct 1, 2013, 9:03:27 PM10/1/13
to nuni...@googlegroups.com
I'm trying to adapt a NUnitLite test runner to use the Category attribute in NUnitLite 1.0, so that I can run a specific batch of tests at a given point. (so, not strictly unit testing) I'm looking at the documentation and the source, but I can't seem to get it to run a specific set of tests with a certain category.

The particular section I'm having trouble wrapping my head around is the second parameter in Load:

private ITestAssemblyRunner runner;
...
IDictionary loadOptions = new Hashtable();
    loadOptions.Add("CategoryAttribute", category); //category is a string
    if (!runner.Load(assembly, loadOptions))
...


My test fixture looks like this
 
[TestFixture]
[Category("Original")]
public class ExampleTest2
{
...


I've tried everything I can think of - "Category", "/include", "-include", and I've tried making my [Test]/[TestFixture] explicit. Without the [TestFixture, Explicit], the test runs every time, regardless of the loadOptions category string. With the explicit, it doesn't run at all.

The NUnitLite release notes say that the runner supports the -include option as per NUnitLite 0.9. What am I doing wrong? Is what I'm doing possible in NUnitLite?

Charlie Poole

unread,
Oct 2, 2013, 12:30:11 AM10/2/13
to nuni...@googlegroups.com
Hi Joseph,

What version of NUnit does the code you cite come from? In NUnit 1.0,
the -include and -exclude attributes are used to create a testfilter,
which is passed as an argument to the Run method of the runner.

Charlie
> --
> You received this message because you are subscribed to the Google Groups
> "NUnitLite" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nunitlite+...@googlegroups.com.
> To post to this group, send email to nuni...@googlegroups.com.
> Visit this group at http://groups.google.com/group/nunitlite.
> For more options, visit https://groups.google.com/groups/opt_out.

Joseph Wang

unread,
Oct 2, 2013, 11:03:19 AM10/2/13
to nuni...@googlegroups.com
Hello Charlie,

Ah, now I see it - TextUI.cs in the /Framework/Runner/ source folder! I should have paid closer attention to the original source. I seem to have got the categories working now (albeit, it's not very clean) - I might chuck it up on my GitHub repo in the coming days.
http://github.com/josephsw/NUnitLite-for-Unity

Thanks again for your help!
Reply all
Reply to author
Forward
0 new messages