locked
running unit tests during gated check-in RRS feed

  • Question

  • Is it possible, during a check-in, to run all and only the unit tests that cover the specific portion of code involved in the checked-in changeset?
    Saturday, October 29, 2016 8:13 PM

Answers

  • Hi Michele,

    The request you posted above couldn't be realized because only when the test runs, it could know which code is covered. If test doesn't run, it can't know which code is used/covered.

    Best regards


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Michele Sarbia Wednesday, November 2, 2016 10:19 AM
    Tuesday, November 1, 2016 2:48 AM
    Moderator

All replies

  • Hi portion,

    Thank you for posting here.

    You could run your unit tests in your gated check in build.

    In your build definition, add 2 build steps and one Visual Studio Test step. This build step is used to build your project and your unit tests project. And the test step is used to run your unit tests.

    And remember to map both your project and the unit test projects under Repository.

    Best regards


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, October 31, 2016 7:46 AM
    Moderator
  • Hi,

    thank you.
    I did not explain myself. I already knew that I could run unit tests in my gated checkin build.
    What i would need is an automated way to run not all the tests but just the subset of them that is meaningful for the changeset that I'm checking in.

    I mean, using code coverage i can see if a line of code is covered by tests. I would like to know which tests cover a specific line of code.

    At checkin time then, I could run all the unit tests that cover all the code lines I deleted or edited with the current changeset, plus all the unit tests that cover the lines of code I added.

    Running all the tests every time or even running them by category takes too much time.

    Thank you,

    Michele

    Monday, October 31, 2016 8:56 AM
  • Hi Michele,

    The request you posted above couldn't be realized because only when the test runs, it could know which code is covered. If test doesn't run, it can't know which code is used/covered.

    Best regards


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Michele Sarbia Wednesday, November 2, 2016 10:19 AM
    Tuesday, November 1, 2016 2:48 AM
    Moderator