Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create an executable (preferably a .exe and not command line) out of a Coded UI Test?

I am trying to create an executable out of a Coded UI Test which opens a browser and performs a set of operations. I would prefer a simple .exe file instead of using a batch file or using MS Test Agent, to be able to run it across computers without issues. Any other way of executing the Coded UI Test with a simple click, without the use of Visual Studio is welcome.

Thanks.

like image 882
K.P. Avatar asked Nov 04 '22 01:11

K.P.


2 Answers

You cannot create a .exe file from CodedUi Project but you can use another Project for that.

Step 1

Create your CodedUi Project. Use the CodedUi Test Builder to create your TestMethod(s) that executes the actions you want.

Step 2

Create another Project that has a reference to your CodedUi Test Projectand calls your recorded Test Methods. If you just need to run only one method then create a simple Console Application. If you need something more complicated (e.g. choose the CodedUI Test Method to run) a Windows Form Application would be more appropriate.

like image 108
chaliasos Avatar answered Nov 09 '22 09:11

chaliasos


I know that is late, anyway this can serve to others more.

You can delegate this work to MSTest, you can do a .bat or make a console application that executes the next:

set MSTestEXE=%PROGRAMFILES%\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe
"%MSTestEXE%" /testcontainer:CodedUITest\bin\Debug\CodedUITest.dll

CodedUITest.dll is the dll that generates Visual Studio.

MsTest will execute all tests showing you the results on the CMD and even will generate the TestResult.trx file.

like image 22
Marco Medrano Avatar answered Nov 09 '22 10:11

Marco Medrano