.NET Framework with parameterized unit testing that shows red / green for each combination?

"Testing with a parameterized module" works great if you have X unit test * Y configurations.

I have 3 unit tests, and each of them should be executed in 5 specific situations.
I use the xUnit.net Theory / PropertyData function , it works well.

PROBLEM: In the test run user interface, there is one green / red character per unit test, which means 3 .
This makes it difficult to evaluate progress: the symbol is red until all configurations work perfectly.
I want 15 characters, one per unit test * configuration, to find out which combination goes wrong.

xunit.net has not yet implemented a function to display 15 characters.

I am ready to switch to another test environment to get this feature.
QUESTION: Does this .NET platform have this feature? Any kind of reports in order (GUI, HTML, etc.)

enter image description here

+4
source share
3 answers

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

+5
source

The 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 attached screenshot. In addition, Resharper has excellent support for unit testing.

Nunit console

+1
source

Pretty sure TeamCity displays them separately from xUnit.net. I believe that the TeamBuild toolkit should also select them, since they are included in the report data.

The xUnit.net GUI and console players identify failed arguments.

Any specific reason why you find it useful to show off individual cases? (i.e. are you trying to get a readable report?)

0
source

Source: https://habr.com/ru/post/1446160/


All Articles