Run multiple test same build from different tests project

1.8k views Asked by At

Need your help in the following scenario:

  • I have a solution with 2 projects with different unit tests
  • Those projects generate 2 different dll: *deployment.dll and *database.dll
  • I have a build on TFS that I want to use to run those tests, I'm using "Test Case Filter" to filter the categories of my tests

    (TestCategory=TEST1|TestCategory=TEST2|TestCategory=TEST3|TestCategory=TEST4) 
    

    and in "Test Sources Spec" I'm filtering both dll (*deployment.dll;*database.dll)

  • *.deployment.dll has TEST2, TEST3, TEST4
  • *.database.dll has TEST1

This doesn't work, tests of *database.dll does not run. Test selected in Visual Studio Test Runner

Could you please help on that? If I make the build with only 1 dll, for example, *.database.dll, TEST1 runs well.

(UPDATE) SCENARIO 1

Test Case Filter: TestCategory=TEST1|TestCategory=TEST1|TestCategory=TEST2|TestCategory=TEST3|TestCategory=TEST4

Test Sources Spec: *database.dll;*deployment.dll

only runs TEST1


(UPDATE) SCENARIO 2

Test Case Filter: TestCategory=TEST1|TestCategory=TEST1|TestCategory=TEST2|TestCategory=TEST3|TestCategory=TEST4

Test Sources Spec: **\*deployment.dll;*database.dll

only runs TEST2,TEST3,TEST4

(UPDATE) Does not find tests in Database.dll enter image description here

2

There are 2 answers

0
HLourenco On BEST ANSWER

Finally, it's solved :)

So, what I have done to solve this problem, was, change Build Process Template.

There are one step in this process, calling: "FindMatchingFiles"

I change this value as the below image shows. (however, from now on, I must use "**\*" in all my filters that use this process template). This operation make sure that I have the assemblies with fullpath destination complete.

If you have different solutions, please post here :)

Special thank you to @Cece - MSFT for all support

enter image description here

7
Cece Dong - MSFT On

I've tested in TFS 2015.3, XAML build, but couldn't reproduce your issue. I'd like to share my steps here for your reference:

  1. I have a solution with some projects, 2 of them are UnitTest projects (UnitTestProject1, UnitTestProject2).

    enter image description here

  2. In UnitTest1 project, I added TestCategory for two test case, check screenshot below:

    [TestMethod()]
    [TestCategory("Pro")]
    public void M1Test()
    {
       //
    }
    
    [TestMethod()]
    [TestCategory("Dev")]
    public void M2Test()
    {
        //
    }
    
  3. Similar to Step2, in UnitTest2 project, I added TestCategory for two test case, check screenshot below:

    [TestMethod()]
    [TestCategory("Pro1")]
    public void M3Test()
    {
       //
    }
    
    [TestMethod()]
    [TestCategory("Dev1")]
    public void M4Test()
    {
        //
    }
    
  4. Edit "Test Case Filter" and "Test Sources Spec" in build definition like below screenshot and queue a build:

enter image description here

  1. The test result is as expected. Only M1Test and M2Test in UnitTestProject1, M3Test and M4Test in UnitTestProject2 are tested.