Sheduling tests - Running Tests From the Command line | Telerik Testing Framework
Telerik test studio Has its own test scheduler so you can schedule tests from the Telerik IDE itself, but what if you're using there Free framework? Telerik Testing Framework
Scheduling can be done using couple of methods,
If you have Team foundation server (TFS) you can create a CI module for this can if you have Microsoft Test Manager you can schedule and run the tests. If you don't have any of those tools but if you still want to schedule and run your tests this is a very simple method you can use. Just follow the below steps
Step 1:
Add a test settings file.
Right click on your visual studio solution select Add > New Item
Select Test settings Tab on the right and click on Test Settings File to your project [Figure 1]
Figure 1 |
Build your solution
Step 2
Create a text file, you can use notepad or Notepad++ for this task
Copy the below code
1: set location="D:\Automation\Myproject"
2: @echo off
3: set hh=%time:~0,2%
4: if "%time:~0,1%"==" " set hh=0%hh:~1,1%
5: set dt=%date:~4,2%-%date:~7,2%-%date:~10,4%_%hh:~0,2%_%time:~3,2%_%time:~6,2%
6: taskkill /F /IM vstest.discoveryengine.x86.exe /FI "MEMUSAGE gt 1"
7: cd %location%
8: "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe" "D:\Automation\Myproject \Myproject.sln" /p:configuration=debug
9: cd "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE"
10: echo %DATE% %TIME% > D:\Automation\Myproject \TestResults\Summary.log
11: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" /test container:"
D:\Automation\Myproject\bin\Debug\Myproject.dll" /testsettings:"D:\Automation\Myproject\Settings.testsettings" >>"D:\Automation\Myproject\TestResults\Summary.log"
12: exit
Following are the properties
The properties in the bold text should be replaced
line 1 - Set Location - Location for the project
line 8 - Verify the Visual studio installation folder for MSBuild.exe
- Solution Path
line 9 - Depends on your VS installation folder usually its C:\
line 10 - Creating a test Summery file - its easier to create that file inside the solution
line 11 - Verify the Visual studio installation folder for MSTest.exe
- Path for the project dll
- Path for the test settings file we added in step 1
- Content of the test results file we created on line 10
If youre using a OrderTest file, change line 11's test container: to
/test container:"D:\Automation\Myproject\bin\Debug\OrderedTest1.orderedtest"
Step 3
Save the file as a .bat file
ex: build.bat
you can store this file in any location but its good to save it at the folder with the solution file. and you can add that build.bat fiel to the project aswell
Step 4
Double click on the bat file, your tests will start running
Step 5
Load windows Task scheduler
Create a new task
Add a trigger time from Triggers tab
Add your build.bat file in the actions tab
Click on OK button
Your tests are scheduled
Happy Testing!!!
Comments
Post a Comment