Search code examples
c#nunitjiratestcasejira-xray

How to have multiple test in jira x-ray, for unit test with different testcase after importing Nunit testresult.xml


I have written a API unit test in C# .net core 3.0 using Nunit framework end of the execution the test framework creates Testresult.xml which at the end I import to Jira xray for creating a test suit..

Now, I have multiple Test cases under 1 unit test name and I can see the same count of test is being created in testresult.xml but when I upload it to jira xray, it shows only one test case name. possibly it's been overwritten due to the same unit test name. How can I have multiple test in jira xray ?

Here is the code sample.

#region --ThermostatMode--
        //[Category("AllDevices")]
        [Category("FlyCatcher")]
        [TestCase("Cool","LCC","FlyCatcher")]
        [TestCase("Heat","LCC","FlyCatcher")]
        [TestCase("Off", "LCC","FlyCatcher")]
        public void LCC_ThermostateMode_FlyCatcher_Positive(string TestCaseID,string deviceType, string deviceName)
        {
            UnitTest_ThermostateMode_FlyCatcher.LCC_ThermostateMode_FlyCatcher_Positive(test, extent, TestCaseID, deviceType, deviceName, JsonInputDetail);
        }

        #endregion

After executing the above code, I get Testresult.xml with all the test case coverage and when I upload the xml to jira xray, It creates only one test with LCC_ThermostateMode_FlyCatcher_Positive, instead, I need 3 tests to be created in jira xray. and when I click on it, it doesn't have any information on which for which testcase the testcase has been created. Somebody please help me.

Jira testcase


Solution

  • Whenever importing results from NUnit XML reports, a Test Execution issue will be created along with a Test (and the related test run for the results) for each test method you have. To see the execution results of each test (i.e. the Test Run) you have to scroll a bit to the right and choose the "play" icon. For data-driven tests, right now those will be imported as multiple entries on the Test Run. So, you'll have 1 Test issue created related to the test method, one Test Run with 3 results within it.