locked
Running Unit Test in Visual Studio 013 RRS feed

  • Question

  • I have a VS2013 solution project along with a Unit test project. I know that during build, I can run the Test project. But  I want to do it only when I will publish my solution. I don't want to run the whole test project each time I try to build my application. Only, when I publish, I want to run the Unit test project. Is it possible.
    Thursday, August 28, 2014 7:39 PM

Answers

  • Hi syedzaman,

    Glad to receive your reply.

    >> So if I disable "Run Tests after build", will it be able to run the unit tests during the build when publishing?

    When you disable "Run Tests after build", it will not run the unit test during the build when publishing.

    Since the “Run Tests after build” means that to run your unit tests after each local build. If you didn’t want to run the unit test after you build app each time, you could disable “Run Tests after build”. If you want to run the unit test after you build app each time, you could enable “Run Tests after build”.

    >>I want the system to AUTOMATICALLY start the unit tests first and then publish it. If any unit test fail, it will give us message and will NOT publish.

    As far as I know, the publish function is used to publish an application. However, the unit test is used to test your application source code before you publish the application. So as far as I know we couldn’t run unit tests and then publish the app automatically. We could run the test manually in test explorer window.

    About this issue, you could submit this feature request: http://visualstudio.uservoice.com/forums/121579-visual-studio. The Visual Studio product team is listening to user voice there.

    Thanks for your understanding.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.


    • Edited by Tina-Shi Monday, September 1, 2014 11:37 AM
    • Marked as answer by Tina-Shi Friday, September 5, 2014 10:59 AM
    Monday, September 1, 2014 11:36 AM

All replies

  • Hi syedzaman,

    >> But I want to do it only when I will publish my solution. I don't want to run the whole test project each time I try to build my application.

    It means that when you build your application each time, it will run all tests in the unit test project, am I right?

    If yes, maybe you enable the Run Tests After Build in Test Explorer Window. So I suggest you could try to disable the Run Tests After Build button, it will not run your test project after you build your application solution each time.

    Reference:

    >>Only, when I publish, I want to run the Unit test project. Is it possible.

    Generally, unit test is used to test unit test application source code, we need to visit the source code/libraries, and generally we test it before we publish it.

    If I misunderstand the issue, please tell me more detail message.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.


    • Edited by Tina-Shi Friday, August 29, 2014 8:15 AM
    Friday, August 29, 2014 8:15 AM
  • Hi: Let me explain. As you mentioned, I will disable to "Run Tests after Build". But when we publish, it builds the application first and then publish it. So if I disable "Run Tests after build", will it be able to run the unit tests during the build when publishing?

    Secondly, as I mentioned I want to run run these unit test only during Publishing. For example, for  as small bug fix, I will fix the bug and build the system to check it. I don't want to run the whole Unit tests process. Then when I publish, I want the system to AUTOMATICALLY start the unit tests first and then publish it. If any unit test fail, it will give us message and will NOT publish.

    Is it possible to do the Unit tests.

    Friday, August 29, 2014 12:26 PM
  • Hi syedzaman,

    Glad to receive your reply.

    >> So if I disable "Run Tests after build", will it be able to run the unit tests during the build when publishing?

    When you disable "Run Tests after build", it will not run the unit test during the build when publishing.

    Since the “Run Tests after build” means that to run your unit tests after each local build. If you didn’t want to run the unit test after you build app each time, you could disable “Run Tests after build”. If you want to run the unit test after you build app each time, you could enable “Run Tests after build”.

    >>I want the system to AUTOMATICALLY start the unit tests first and then publish it. If any unit test fail, it will give us message and will NOT publish.

    As far as I know, the publish function is used to publish an application. However, the unit test is used to test your application source code before you publish the application. So as far as I know we couldn’t run unit tests and then publish the app automatically. We could run the test manually in test explorer window.

    About this issue, you could submit this feature request: http://visualstudio.uservoice.com/forums/121579-visual-studio. The Visual Studio product team is listening to user voice there.

    Thanks for your understanding.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.


    • Edited by Tina-Shi Monday, September 1, 2014 11:37 AM
    • Marked as answer by Tina-Shi Friday, September 5, 2014 10:59 AM
    Monday, September 1, 2014 11:36 AM