Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET test framework with parameterized unit testing, that shows red/green for each combination?

Parameterized Unit Testing is great when you have X unit test * Y configurations.

I have 3 unit tests, and each must run in 5 particular situations.
I use xUnit.net's Theory/PropertyData feature, it works well.

PROBLEM: In the Test Runner UI, there is one green/red symbol per unit test, which means 3.
It makes it difficult to evaluate progress: the symbol is red until ALL configurations work perfectly.
I want 15 symbols, one per unit test * configuration, to know what particular combination is going wrong.

xunit.net has yet to implement the feature to show 15 symbols.

I am willing to switch to another test framework just to get this feature.
QUESTION: Does any .NET test framework have this feature?
Any kind of reporting is fine (GUI, HTML, etc)

enter image description here

like image 596
Nicolas Raoul Avatar asked Nov 15 '12 08:11

Nicolas Raoul


2 Answers

You can use TestCaseAttribute or TestCaseSourceAttribute of NUnit to specify different parameters for test. Each test case will be shown as separate test in test runner.

like image 50
Sergey Berezovskiy Avatar answered Oct 18 '22 10:10

Sergey Berezovskiy


NUnit console will show you which test case failed. Example:

[TestCase("ABK")]
[TestCase("bgba")]
[TestCase("CBVS")]
[TestCase("DSBH")]
[TestCase("E")]
[TestCase("FJMC")]
[TestCase("HBTV2")]
[TestCase("JFFC1")]
[TestCase("K")]
[TestCase("LBHG")]
[TestCase("MJCM")]
[TestCase("PHJL")]
[TestCase("R")]
[TestCase("TDPP")]
[TestCase("UGV")]
[TestCase("VXHC")]
[TestCase("YFD")]
public void Given_a_main_supplier_categorie_then_it_should_return_a_collection_of_RM_categories(string supplierCategory)
{
     // test code here
     // ....           
}

See the attached screenshot. Also, Resharper has great support for Unit Testing.

NUnit console

like image 2
Rui Jarimba Avatar answered Oct 18 '22 10:10

Rui Jarimba