4

I have a .Net core that builds successfully using VSTS. The issue I'm presenting is that Unit Tests aren't being discovered when building the project. I know this is similar to this post but I just wanted to bring up more details in case someone has a good idea seeing this description.

This a summary of the logs:

  1. ##[warning]Project file(s) matching the specified pattern were not found.
  2. ##[section]Finishing: Test.

enter image description here I'm concerned about the minimatch pattern used here. It seems is looking for a Tests folder and then any file that ends in .csproj

The default agent queue is Hosted VS2017 as indicated by @starain-MSFT in previous post enter image description here

The solution structure is described in the next image, is pretty basic:

  1. A .Net Core project with a model class.
  2. A MS Unit Test Project (That contains a reference to the mentioned class).
  3. A [TestClass] with a single [TestMethod] that pass the test.

enter image description here

Luis Armando
  • 444
  • 1
  • 7
  • 17
  • So did you try other patterns that are in line with how your solution is structured / named? – Martin Ullrich Jun 06 '17 at 18:58
  • Yes @Martin Ullrich, I have tried other minimatch patterns and I discovered that this is the key of the solution. I will be posting the answer in few minutes. – Luis Armando Jun 06 '17 at 19:00

1 Answers1

7

Well, it resulted that my concern was the key factor to solve my issue. I just made a little reverse engineer with an MVC project, the default minimatch pattern is different for this type of project, (**\$(BuildConfiguration)\*test*.dll !**\obj\**)

You can learn more about minimatch here.

So I just wanted to look for a .csproj file that contains the word Tests, therefore I changed it to **/*Tests*.csproj instead of **/*Tests/*.csproj.

Now I'm able to see that my unit tests are being executed right away when there is a new build.enter image description here

I hope that my issue and resolution helps saving other people's time!

Luis Armando
  • 444
  • 1
  • 7
  • 17