lundi 1 août 2016

c# - MSTEST - Test result file in MSTest shows all attachment for each of the test (Both Pass and Fail)

I have a selenium automation suite and the test cases has the capability to take a screenshot if a test fails.

All the test are unit tests and are datadriven. What I meant by data driven is that the test gets executed for each of the data row. please see sample code below

    [TestMethod]
    [TestCategory("UITest"), TestCategory("Flow")]
    [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\allFlows.xml", "flow", DataAccessMethod.Sequential)]
    public void MyTest()
    {
       //TEST CODE
    }

The above code is datadriven by the number of dataflows in allFlows.xml

The issue I am facing is when a test fails,a screenshot gets generated and I am able to see the screenshot attached to each of the test ( including the pass tests) I believe this is making the trx file heavy and ugly

Say for example I have 1 tests there is 5 flow data in allFlow.xml. So the total test executed is 5 and lets say that 2 tests failed.

The report says that 3 test passed and 2 test failed. I have now 2 screenshots for two failed tests.

The issue is the screenshot is getting attached to all the 3 passed test in addition to the 2 failed test.

Any idea how to resolve this issue? Do I need to live with it as it is a microsoft feature/ bug??

The issue is similar to this C# - .NET - MSTest - Test context - Add result file - Selenium Screenshots - Issue while viewing the result file

and I remember a similar issue was raised by someone and there was no resolution for this?

Is this a MSTest feature?

Any help would be great.

Aucun commentaire:

Enregistrer un commentaire