Unit tests not running in build type

I created a build type that includes a test project and has a configured test list.

When I run the build through Team Explorer, the log file reports:

: warning : Test <testname> can not be found.

It lists the four tests I have in my test list, so it can see the list, but can't find the tests.

What am I doing wrong

TIA

jdn



Answer this question

Unit tests not running in build type

  • fscarpa58

    It's good to know about those. I had no idea.

    Problem resolved. Needed to set up an alias on the build machine to see the dev SQL Server at all. All tests pass.

    Thanks for the help.

    jdn


  • anu_ooo

    The tests do appear. They are new and so have never moved.

    This article:

    http://msdn.microsoft.com/msdnmag/issues/06/03/Bugslayer/default.aspx

    suggests the problem is because there are hard-coded paths in there somewhere (my local machine where I develop uses the c: drive for instance, while the build machine uses the d: drive for its directory structure.

    Is this correct

    jdn


  • Simon Dahlbacka

    Hi,

    We hard-code relative paths, so that won't affect having different drives. I just tried reproing the scenario and it does work correctly for me.

    Is everything checked in
    Can you try creating a new test list, adding your tests, and checking in again

    Please let me know how it goes

    Thanks,
    David Gorena Elizondo
    [MSFT] VSTS


  • Maddinel

    Hello,

    Sorry to hear you're not having a good time here. For the problem you're having with failing tests, I suggest looking at the trx files and trying to find any helpful error messages. If you can't find anything, you might want to add information to your tests to try to get to the cause.

    For your second question, if you want to change the tests that are run by the build server, you have to edit the vsmdi file (by removing tests from the test list); if you want to change the actual test list that gets run, yes, you have to modify the build type file.

    Thanks,
    David Gorena Elizondo
    [MSFT] VSTS


  • Mitch Walker - MSFT

    Where are the .trx files located

    jdn


  • Daikoku

    Hello,

    I'm guessing that your tests are not inside the test lists anymore. This could happen if you moved the project, or the tests. Open your solution from Source Control, and verify that the tests do appear inside the test lists (and not as broken links). If they don't, include them and check-in the vsmdi file again.

    In general, the process that you can follow to actually verify that unit tests inside test lists do run in a build type is the following:
    1. Create a new test project with unit tests
    2. Create a test list
    3. Add the unit test to the test list
    4. Check everything in to source control (can do this from Solution Explorer)
    5. Create your build type, specifying that you want to run everything inside your test list
    6. Build

    Thanks,
    David Gorena Elizondo
    [MSFT] VSTS


  • GuyFawkes

    I'm still having a heck of a time with this.

    I decided to delete the test project, recreate it under a different name, and try again (for reasons not clear to me, I had to shut down my solution, reboot, and then do it for it to work...multiple errors of missing file paths, COM automation, etc.).

    So, now I have a test project with 108 tests. The build server can see all of them and run them.

    The problem is all 108 pass when I run it locally, but only 54 of them pass on the build server. The ones that fail are database tests, but when I run a profiler, I don't see any attempt to connect to the database server (the server name is explicitly in the app.config file, so it isn't trying to hit the build server).

    Why Why does it work locally and not on the build server

    Also, is there any other way of changing the lists of tests associated with a build type without manually checking out the build file and hand-editing it

    jdn


  • Wayne Sepega

    They're located on your server machine, under your team build folder, and under test results, something like this:

    \\<your_machine>\<TeamBuild>_20060817.1\TestResults

    Thanks,
    David Gorena Elizondo
    [MSFT] VSTS


  • Unit tests not running in build type