C# Automated Unit Test


Windows Server 2008 + Unit Test Automated

Automatice setup your unit test in Job, so like everyday at night, run all the unit test, You'll check the morning. This's article showing how to set it up with Task Scheduler in Windows Server 2008

1. Prepare command file

For instance, you could create following file with extention, cmd. So the first line of command is for, go to location where your MSTest.exe. Next line, find your actuall unit test location, run the category you specify on your unit test method's attribute.

cd C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE

MSTest /testmetadata:D:\{path pointing to your unit test location}\UnitTest.vsmdi /category:"MyTest"

2. Setup Job on Task Scheduler

For example, you want to run your unit test everyday at specify time. Following are steps how to set it up By using Windows Server 2008 Task Scheduler.

1) Open Task Schedular


2) Enter your test name


3) open trigger tab, and choose what's time you want your unit test to run.


4) click action tab, select what's command your created



That's all about it, from right now, it'll run the unit test you created everyday.