w[warning]No test result files were found azure devops

Viewed 891

I have created a simple .net core web app with sample unit test cases and build CI/CD using azure devops. My test cases are always returning true and I have tried executing them through visual studio as well. Please see below my Unit test case class.

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTestProject1
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            Assert.IsTrue(true);
        }

        [TestMethod]
        public void TestMethod2()
        {
            Assert.IsTrue(true);
        }
    }
}

I have used azure repository as git and created pipeline for CI. But when the test step of the pipeline is executed I get "[warning]No test result files were found" warning in the logs and my test cases are not executed. I have attached snip of test step in CI pipeline. Please suggest what is wrong here.

enter image description here

1 Answers

Remove the '1', rename your UnitTest1 class to UnitTests. Make sure all your unit test class names end with Tests. But only on the class names, your test methods can have any name you want.

Related