简体   繁体   中英

Should Unit Tests Be Run On A Local Machine?

Recently I've been tasked with writing and running unit tests in C# for a desktop application. In the past, I've written mainly automated functional/GUI tests. These get run on dedicated QA machines because these tests can cause crashes, data loss, Blue Screen of Death, etc. Should a similar setup be done for running unit tests? Are there any risks with running unit tests on my local machine?

Unit tests should run on your local machine AND on the build server. They are an invaluable resource as feedback for the developer. The DEV should write the unit tests. Before checking in, he should run the unit tests to make sure he does not break anything. The build server will then run the unit tests again, in order to make sure nothing it actually broken, and that the integration with other code, if any, succeeded.

When the unit tests have run, preferably, the build server should then run integration tests and automated UI tests. When these processes have finished, a build has been produced with no known defects - at least none that is covered by the tests. In other words a green build means the software integration went well, and the developers can keep checking in - or at some point start doing manual testing before actually releasing a piece of software.

Software testing nirvana happens when enough tests has been automated, so that the developers and the business can feel safe releasing a product based only on the success of this stream of automated tests. In reality, only a few products will be this mature - and some amount of manual testing is required.

Unit tests does not touch external systems or interfaces. Therefore, there are no risks by running them locally.

Unit tests should be so isolated that they can be run on every machine without any further setup. Unit tests by definition test only functional units on a very granular level without touching external systems (ie database, file system, etc.)

Unit Testing is typically done by the Developers while developing. So Run it on your Development environment. Probably your Local machine.

well if your local machine is a dev machine I see no risk since the machine is not a production end user machine. You can also consider TFS Lab management (in case you have Microsoft TFS as ALM / source control system). in that case you can create virtual or physical test environment and the application gets deployed and tested in those defined environments.

not sure what the names of similar test products are for non TFS scenarios.

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