I am going to execute below simple hand written Coded UI test to launch a notepad, using a Console Application.
Create Console Application in VS 2012. Refer the Coded UI in the Console Application. Then add below references to below assemblies.
Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
Microsoft.VisualStudio.TestTools.UITest.Common.dll
Microsoft.VisualStudio.TestTools.UITest.Extension.dll
Microsoft.VisualStudio.TestTools.UITesting.dll
from C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies\
Microsoft.VisualStudio.TestTools.UITest.Extension.IE.dll
from C:\Program Files (x86)\Common Files\microsoft shared\VSTT\11.0\
Microsoft.VisualStudio.TestTools.UITest.Framework.dll
Microsoft.VisualStudio.TestTools.UITest.Logging.dll
Microsoft.VisualStudio.TestTools.UITest.Playback.dll
from C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\
Then add below code to Console Application
This Console Application now can run Coded UI test.
18 comments:
I've written about "hand coded" CUITs on my blog.
Some topics:
-- Keep Your Page Objects Clean and DRY
-- Clean and DRY Verifiers
-- Getters and Setters
Hi..
I am getting Type.Initialization Error while executing Playback.Initialize() method.
Hi Rasool,
In the console application project properties make sure it is selected as ".net framework 4.5" for Target Framework. This could be that the target framework is set to ".net Framework 4.5 Client Profile"
Thanks for this, I've been scratching my head over it for a while. My problem was the lack of Playback.Initialize().
Hi Chaminda, I am getting null reference exception inside the Test method, where i am calling TestContext.WriteLine(""). How can i fix this?
Thanks. This is exactly what i was looking for.... :)
Thanks. This post was very helpful.....
Thanks a lot...
I was missing the Microsoft.VisualStudio.TestTools.UITest.Extension.IE.dll ...
my program was always throwing exceptions at "Playback.Initialize();"
Hi,
I am getting following error
An unhandled exception of type 'System.AggregateException' occurred in Microsoft.VisualStudio.TestTools.UITest.Framework.dll
Please help..
Sam
Hi,
I got the solution of above problem.
I needed to add the reference of following dll as well
Microsoft.VisualStudio.TestTools.UITest.Extension.IE.Communication.Interop.dll
Sam
Thanks,
those few lines of you just made my day. Been looking for way to long to solve this.... THX
Hi,
I am getting following exception on running the program
AggregateException was unhandled. I have added all the mentioned dll including Microsoft.VisualStudio.TestTools.UITest.Extension.IE.Communication.Interop.dll
Please help
Hi Anonymous,
AggregateException is actually hiding the original exception. You can follow instructions in below links and find the original exception.
http://stackoverflow.com/questions/11122092/how-to-fix-system-aggregateexception-occurred-in-mscorlib-dll
Can we run this console application in machines without visual studio 2013 with only .NET 4.5.1 installed
Hi ppl,
I'm getting the issue with Playback.Initialize().
Can anyone help me downloading the Microsoft.VisualStudio.TestTools.UITest.Extension.IE.Communication.Interop.dll
My mailId - sumithan.7989@gmail.com
Regards,
N. Sumitha
Hi Chaminda,
I have a requirement to run coded ui test from WPF application. I am trying to initialize playback and call test method as you mentioned. However, my test cases are data driven and i need to access the testcontext. but the testcontext in this case comes out to be null. Could you please provide some inputs what can be done in this regard?
Many thanks.
There are a few additional DLLs required for doing this in VS2015 CodedUI.
Microsoft.VisualStudio.TestTools.UITest.WindowsStoreUtility
Microsoft.VisualStudio.TestTools.UITest.Extension.MSAA
I *think* that's the additional ones I had to add as per exceptions thrown.
Any ideas on how can you determine the success/failure of the running test programmatically?
As per my previous comment, I *think* the following http://stackoverflow.com/a/33920372/2312877 will allow you to see the success/failure of the actual test within the console app (sounded right in theory anyway). I'm still playing around with trying to figure out how to write out the test results to the "TestResults" folder as per a normal run of the coded UI test.
If you have any ideas it's most appreciated! :)
Post a Comment