开发者

How to run Coded UI Tests against the Windows Azure SDK v1.4

I have an MVC3 web application that has grown to the point I want to start automating some of the functional testing. So, I've been trying to add a Coded UI Test to the same project that I put unit tests into. Nothing but frustration.

I have been able to record a simple series of steps: logging into the application.

I was able to generate the code and I can see the generated code 开发者_高级运维in a file named UIMap.Designer.cs. An instance of this class is instantiated and the test method is called in a file I named LoginTest.cs.

When I try to right-click on the [TestMethod] in LoginTest.cs and choose Run Test, I was initially getting the following error:

Unable to load the test container 'C:...\WebRole.Tests.dll' or one of its dependencies. Error details: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

So, I flipped the following References from Copy Local = false to true:

  • Microsoft.VisualStudio.TestTools.UITesting
  • Microsoft.VisualStudio.TestTools.UITest.Extension
  • Microsoft.VisualStudio.QualityTools.CodedUITestFramework

Now, when I run the test, I get the following output:

Testing started:

Total tests: 1, filtered: 1

No tests found.

Duration : 94.9989452249951

A browser instance isn't started. Neither the Azure Compute nor the Azure Storage emulators are started. The application isn't packaged and deployed. In short, none of the things that happen when I run the application seem to happen. So, I'm puzzled about how the UI Test could run at all, since the Azure emulator environment isn't running.

To work around this, I tried opening two instances of VS2010. In the first, I ran the application as usual to get the Azure emulators running and the application deployed. In the second, I ran the CodedUITest method. Same results.

Now, I'm stuck. Is anybody else able to run a Coded UI Test against the Azure emulators provided with Azure SDK v1.4?


This is probably way too late for the OP, but may help someone else with a similar issue (that was me a couple of hours ago).

Caveat: I'm a complete newbie with CodedUI, so this may not be the right way to do this. But at least it got me started.

I've got a similar situation: Azure 1.4, ASP.NET MVC (2 in my case) web app. I want to start a suite of UI tests that I can run in my desktop development environment (VS2010 Premium).

Here are the steps that got me started: 1. Record a bit of a CodedUI test - just so you'll have something to see running to prove that you are able to do this. (I followed the first few steps from this: http://msdn.microsoft.com/en-us/library/dd286608.aspx).

Open the browser before you start recording and record everything you need to do to start your web app.

  1. Add initialization code to the test to start the browser: In your Coded UI test class, add a method with a [TestInitialize] attribute:
    [TestInitialize]
    public void LaunchBroswer()
    {
        BrowserWindow browser = BrowserWindow.Launch(new System.Uri("https://127.0.0.2/Logon"));
    }

Your URI may, of course, vary. This was the bit of magic I had to infer from some other posts. Having TestInitialize in a collapsed code region didn't help.

  1. To run the tests, start the Azure emulators: Ctrl+F5 (which will start the web app in a browser, but not running the test.

  2. You can now run the test from the same instance of VS that you started the emulators from.


the pain you are experiencing is not only related to Azure, but to coded UI test as a whole IMHO. for MVC (and asp.net) there are a couple of tools that could ease the pain (and you'll not need the coded ui suite).

did you try SpecFlow and WatiN? there is even a package you can use from Nuget that is build as part of the MVCContrib library.

hope it will help you to test the UI.

checkout channel9 for some instructions like: this video

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜