Import xUnit tests fails for "Skipped" tests

Hello!
I have written some unit tests that are still disabled (marked with the “Skipped” hint) and continua-ci seems not to be able to import the results with the “Import xUnit Tests”.
Is this a bug? I found here the same topic for importing JUnit tests, but nothing for xUnit.

Hi @tdestro,

This works for us. If we mark the tests as follows:

[Fact(Skip = "Reason for skipping")]

The tests are listed in the “Not Run” section with the result “Skip”.

How are you marking your skipped tests?

Can you send us your test results xml file via direct message (click on my profile icon and then hit the Message button) or via email to support at finalbuilder.com?

Hello!
I was trying to do it in a “Theory” actually.
Is this also possible?

Hi @tdestro,

Can you provide an example of a test with attributes that does not work as expected?

The following test is skipped correctly in our tests:

[Theory(Skip = "Skipping as requirements are not clear")]
[InlineData(1)]
[MemberData(nameof(Data))]
[ClassData(typeof(TestData))]
public void Test_Skipping_With_Theory(int expectedValue)
{
	//Assert  
	Assert.NotEqual(expectedValue, int.MaxValue);
}

This is the unit test code

        [Trait("Category", "Unit")]
        [Theory(DisplayName = "Theobald.Common.TryParseTime", Skip = "I want to skip this test")]
        [InlineData("c:\\myfile.dne", true)]
        public void DeleteFile(string fileName, bool fileExists)
        {
            IoHelper.DeleteFile(fileName);
            bool myReturn = System.IO.File.Exists(fileName);

            Assert.Equal(fileExists, myReturn);
        }

And this is the message that comes from continua:

Fail action if any tests fail: True
Fail action if any tests error: True
Error importing file [hidden_path]\XUnitTestAdapter\Results.xml
System.NullReferenceException: Object reference not set to an instance of an object. at Continua.Modules.Builds.Actions.UnitTest.XUnitParserHelper.ParseTestNode(IBuildSteppingContext context, List`1 unitTests, XElement test, String assemblyName, String fullClassName, String testName) at Continua.Modules.Builds.Actions.UnitTest.XUnitParserHelper.ParseReportV2XmlDocument(IBuildSteppingContext context, String reportFilename, XElement assembliesNode) at Continua.Modules.Builds.Actions.UnitTest.XUnitParserHelper.ParseReport(IBuildSteppingContext context) at Continua.Modules.Builds.Actions.ImportXUnitTestsAction.Execute(IBuildSteppingContext context).

OK, so there’s an error occurring when importing the results file.

We have just copied your unit test to our project and ran it through Continua CI DotNet Test action. We don’t see any errors importing the test using Import XUnit Tests action and the test is imported as a skipped test.

As we are unable to reproduce the error, we will need a copy of your test results xml file to investigate further.