简体   繁体   中英

How can I run a unit test project and return the results to an external application?

Currently, I am attempting to create a simple console app that does the following:

  1. Compile my project
  2. On Success, Compile/Run the Unit Tests
  3. On Successful tests, continue with the remainder of the program

I'm stuck on a couple of things:

  • How do I verify that the compilation was successful?
  • How do I execute the unit tests?
  • How do I verify that the unit tests passed?

Note: I'm not 100% sure that a custom console app is the right thing to do here, so I'm open to using existing tools/apps as long as they are very lightweight, cheap/free, etc.

Successul compilation
Have a look at msbuild options (see this post)

Execute unit tests
You can easily run NUnit console and that returns the number of failed tests if any, depending on that return value you can run the rest of the program. This achieves all your requirements, free, light-weight and easy to use. More info here .

Verify unit tests passed
Same as above

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM