Running an encoded user interface test from a standalone application

I found several blog posts on how to run UI code tests using the mstest utility, but I need to run them from my C # application. I tried the simplest thing: I created a console application, added links to

  • Microsoft.VisualStudio.TestTools.UITest.Logging.dll
  • Microsoft.VisualStudio.TestTools.UITest.Playback.dll
  • Microsoft.VisualStudio.TestTools.UITesting.dll

and I tried calling the user interface testing method from my application. I got the following error:

The following is not a valid technology name: MSAA. To search for a control, you must specify a valid technology name. 

I tried to reference other assemblies related to testing the user interface, but the error remains the same. Maybe there is something that I should add to App.config in order to be able to run tests?

+4
source share
7 answers

I am doing an encoded user interface test with a bat file, you can simply copy the .dll test CUIT file to your application and invoke it using the bat executable. Even you can use test agents to run code code tests from different computers where you do not have Visual Studio.

my bat file is as follows:

Run all test methods from a DLL:

 "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe" /testcontainer:"DLL_Location\CUIT_03.dll" /resultsfile:"ResultFile_Location\result.trx" 

Run a single testing method from the DLL:

 "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe" /testcontainer:"DLL_Location\CUIT_03.dll" /test:"TestMethodName" /resultsfile:"ResultFile_Location\result.trx" 
+4
source

I had a similar problem when working with MSTest in C #. I use Selenium, so I assigned my base class to the [TestClass] attribute. I need CodedUI to test file downloads. When I changed it to [CodedUITest], it worked.

+1
source

Will you solve your problem if you call MSTest from C #? If so, this MSDN message tells you how .

Otherwise, I would try using the disassembler in MSTest to find out what it does and what links it uses. A quick look at this pointed me to Microsoft.VisualStudio.QualityTools.ExecutionCommon, as well as a class called "Artist" in Microsoft.VisualStudio.QualityTools.CommandLine.

May I ask why you need to use CUIT from C #?

0
source

I believe that you are missing some links, try this blog, these are all the links you need:

 c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\ Microsoft.VisualStudio.TestTools.UITesting.dll Microsoft.VisualStudio.QualityTools.CodedUITestFramework.dll C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\image Microsoft.VisualStudio.TestTools.UITest.CodeGeneration.dll Microsoft.VisualStudio.TestTools.UITest.Framework.dll Microsoft.VisualStudio.TestTools.UITest.Playback.dll 

Try this blog: http://blogs.microsoft.co.il/shair/2010/07/15/running-codedui-test-from- other-application /

it lists all the referees you need (tried ot, and it works for winforms (MSAA)).

0
source

Make sure that your application works as 32 processes, since the encoded user interface does not work with 64-bit processes and cannot be used in them.

0
source

Hello His work is in my case: use the code below ==>

 Playback.Initialize(); CockpitAutomate.CockpitAutomate c = new CockpitAutomate.CockpitAutomate(); c.RunCockpit(); Playback.Cleanup(); 
0
source

Source: https://habr.com/ru/post/1447346/


All Articles