Building application after all test cases pass

Hello,

I have a windows application and a test projcet for that. I can run all the test cases separately but i want when i build my main application(Win), first it should run all the test cases and if all test cases pass then build main application, otherwise not.

Can anyone tell me how to configure this within VS IDE

Thanks in advance




Answer this question

Building application after all test cases pass

  • GaryWH

    Hello

    I'm not sure I understand exactly what you want to do. The model that we follow is building a project, and afterwards running tests against it to make sure that everything is okay. If this is what you want to do, here are the steps:

    1. Connect to Team Foundation Server
    2. From Team Explorer (View | Team Explorer), right click your server and create a New Team Project
    3. After you sucessfully create your project, look for "Team Builds" under your project name, right click it and choose "New Team Build Type"
    4. A wizard will appear. Just follow it. The part that you are interested in is the "Selections", where you actually select the solutions that you want to build and run tests against.

    If this is not what you want to do, please let me know, and tell me a little more about your scenario.

    Thanks,
    David Gorena Elizondo
    [MSFT] VSTS


  • Sura_Arumugam

    Hello,

    You do need to use TFS. If you created tests against your application using code generation, you definitely created a test project that is part of the solution that contains your application. Selecting your solution will take care of your test project if this is the case.

    The build steps will be the follwing:
    1. Your sources will be compiled:
    a) Your sln will be compiled
    b) Your project files will be compiled
    2. Your tests will be run
    3. If all of the above succeed, then the build will be successfully created; If any of the above fail, then the build will fail

    Considering what I understand by reading what you want to do, I think this is the scenario that you need. I don't think you want to run your tests before compiling your application because first you want to be sure that your application compiles correctly. Anyway, if this is not what you want please let me know.

    Thanks,
    David Gorena Elizondo
    [MSFT] VSTS


  • m_t

    Hello David,

    I went all the steps(Creating Team project, craete a build type, select solutions...), but when i build the my project i got this error:

    TF42046: The build service used on the build process is not reachable. This error occurs when build machine is off-line,service not running, team build is not installed, build is not configured.......

    Ok how ever this error is related to TFS Build configuration. I need to solve this error first. I am quiet familar with configuring TFS, before i have build many times on TFS, but that was on beta 3 refresh. Now i have upgraded it to RTM so it showing error.I need to do something for that.I will let you know after i able to build projects on TFS.

    Ok thanks a lot for my actual question(building app after all test cases pass). Hope i can achive my target.



  • OmarSoto

    Hello David,

    Thanks for quick reply.Your understaning is absolutely right. That is what i wanted.Today I did not get a sec to test it due to some other work. I hope i will achive what i wanted. Definitely I will test it tomorrow and let you know the results.

    Thanks a lot.



  • Michael404

    Let me clear you what i want...

    I want first all my test cases of test project should run and if all those pass then build my main application.I created test project by right click on a function(in applicaion) and click on "Create Unit test" and there i checked all the procedures, functions those i wanted to test. So when build my main application, first it shoould run all the test cases and if all pass then create build otherwise not.

    I wanted to do it without using Team Foundation server. So is it possible to configure without TFS

    If no....I tried the steps you gave. Under the "Selections" section, the solution for the test project did not list. So how i can add solution of my test project I can select my main apllication's solution. I checked in both my main project and test project to TFS and under the source control explorer i can able to see those but not .sln file for test project. or simply selecting only solution will take care of test project

    Even if i am able to select test project, will it show me the "Test View" window when i build a "Build Type"

    Thanks a lot



  • Building application after all test cases pass