Wednesday, January 18, 2017

Deploying a selenium test project on clients server/PC

I was able to successfully run all my selenium test cases thru VS test explorer by right clicking on it.
But after some time client ask me to provide the test suite in order to deploy it on there server.(which dont have VS, only MS test framework)

Then i navigate to bin folder of my solution and copy everything on it zip it and send it to client.

Idea is to run the project dll using MSTEST test runner, as below.

set mstestPath="C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE"

%mstestpath%\mstest /testcontainer:SeleniumTestProject1.dll

But client got this weird error on there server.

Test Run Failed.
  Failed  10
  ---------
  Total   10
Results file:  E:\Users\<user>\documents\visual studio 2012\Projects\TestWithSeleni
um3\TestWithSelenium3\bin\TestResults\<user>_ES-NB-110 2017-01-18 22_11_17.trx
Test Settings: Default Test Settings

Run has the following issue(s):
Warning: Test Run deployment issue: The assembly or module 'WebDriver' directly
or indirectly referenced by the test container 'E:\Users\<user>\documents\visual st
udio 2012\Projects\TestWithSelenium3\TestWithSelenium3\bin\testwithselenium3.dll ' was not found.

Then i tried the same on my PC on a different location and i got the same error.

after googling i found a easy solution.

Just add
 string value = AppDomain.CurrentDomain.BaseDirectory;
to your code (at the start point of your test method) Add a breakpoint to the newly added code and check what is the path of value variable.
continue the test process and after everything get success navigate to the folder of values variable.
You might see all the dlls inside the folder. Just copy them and past ware ever you want and execute the project dll using mstest command line tool.
set mstestPath="C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE"

%mstestpath%\mstest /testcontainer:CodedUITestProject1.dll

Then i again bundle the everything inside the folder (values folder) and send it to client.



No comments:

Post a Comment