Thursday, May 26, 2016

Automatically run CodedUI test methods by scheduled tasak

1).Create the test methods and run it thru the test explorer at the visual studio.
You should get the green color test pass view at the test explorer.


2).Navigate to solution explorer and click on "Open folder on file explorer"

3.Inside the bin\debug find the .dll file.
There will we only one dll file.

4).Open a note pad and write down below things.

//Navigate to the debug folder where you found at the step 3.
cd "E:\Users\cja\documents\visual studio 2012\Projects\PowerBI\PowerBI\bin\Debug"

//some times windows will fail to navigate to the exact location so have to do this.Mos of the time this happens when the cd command contain some other drive rather than "C" drive.
e:

//Find the MSTest.exe path and add it to a variable.
Most of the time below is the default location of the MSTest.exe .
set mstestPath="C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE"

//we use the above variable and then the MSTest.exe file and then a keyword.
Keyword should be pointing tot the dll whcih we found at step 3.
%mstestpath%\mstest /testcontainer:PowerBI.dll

5).Save the file as a bat file
6).Make a scheduled task using the above bat file. :)



No comments:

Post a Comment