Tuesday, November 16, 2010

First attempts with CodedUITests with Silverlight 4

In fact my really first attempt with Coded UI was in Dec 2009
http://memoprojects.blogspot.com/2009/12/silverlight-and-microsoft-test-and-lab.html, but, back then, I had  a nice message "Microsoft Silverlight is not supported.. Test paused.".


On the 15th Nov 2010, Microsoft has released VS2010 Feature Pack 2, and I was waiting for a while for it. Now I tried it on our complex Silverlight 4 LOB Application.

1/ .... well, well,  ... here is my first go :
We can record a new Coded UI Test for Silverlight :

However, no Silverlight controls were detected. "Verify that the application under test is built using Silverlight assemblies with a version 4.0 or greater and that a reference to the Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll assembly has been added to the project".

and add the missing DLL : Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll

I was just used to use HP QTP to perform the tests, for which it requires no modification of our application (i.e. no need to add any additional DLLs on our projet - that you have to use a switch mechanism so that they are not released in the production environment ! ).

If you don't add the extra MS DLLs, your Coded UI Test Builder will be empty, even if you click like crazy on your Silverlight application :
After having inserted the DLL on ALL our composite view projects (because of MVVM et PRISM), I ran it again... but still the same problem. Then, I tried to add the DLL only to one project : Still not working.
==> I'll have to try it on a tiny project first.

2/ My second try was on a small Business project :
Seams to work fine and to record... up until the point when I click on "Generate Code"
At that point, my Visual Studio was in debug mode, and I had the nice popup :
"cannot generate code because you are in debug mode" !!

3/ Let's try again !
 Yes it works... but only on a small project, and with few crashes...


4/ Conclusion of my first 'go'
Whereas my first trial of TELERIK WebUI Test Studio with Silverlight was fully satisfactory (with a large Silverlight project with MVVM and PRISM patterns),
my first go with MS Coded UI with Silverlight was a bit disappointing even if it offers more integration with the TFS Software factory.

5/ My second trial : Remove all references to the DLL, excet for 1 project in our MVVM PRISM4 project (i.e. I can record only one screen)

First crash : The Coded UI Test Builder requires me to use a 100% Zoom scale for my IE browser. Else, you'll have this warning "Windows Enternet Explorer zoom setting must be set to 100%. Please change the value to 100% and try again.",






Once back to 100%, this crashes Coded UI !!


Restart again, then the recording FINALLY works !!
However, I never managed to record again (even after a reboot).

Enough for today ! I'll try again another day... hence back to TELERIK WebUI Test Studio et HP QuickTestPro (that requires no additional DLLs on our project to make it work) ;-)

Note : I tried coded UI on the Windows calculator (calc.exe) : no problems. Then I started to use it for "a real need", such as with "SQL Server Management Studio" within wizzard to generate T-SQL Scripts. It works nearly properly : No errors during the recording, but a mini problems do not allow me to use it to "Run" afterwards. Indeed, it stops the playback when dealing with some Drop Down List (although with some DDLst on other windows it works).

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.