Introduction to the UI test of silverlight4.0

Source: Internet
Author: User
Tags visual studio 2010

Recently, I have been studying Silverlight UI testing. Previous Silverlight versions do not support UI testing very well. Fortunately, we now have Visual Studio 2010 Feature Pack 2, this UI test is much easier! The following is a step-by-step implementation:

Step 1: Create a test project first

Select Code UI Test

Next, you don't need to go into details, you know :)

Step 2:

That is, you can run the project you want to test, or publish the project, either through IIS or TC. The following interface should look like this:

Note that there is a small UI of uimap-coded UI test builder, which must be available!

Step 3:

Start the test. Click Start recording. For example, if you want to test the mouse click event, click the map.

Step 4: generateCodeGenerate Code. The Code is generated in the UI test project.

The main thing is in uimap. Designer. cs. codeduitest1.cs only calls the method.

Step 5: Get the expected value. This is now necessary. Drag it to find what you want

Find the desired result and let it go. Then an attribute box will pop up.

Then you can add assertion,

OK. Click Generate code to generate the code for the expected result.

OK, run.

Look at the results:

Why is it wrong? The answer is that my page is not in the initial status during recording, so make sure that the page is in the initial status before running! Then there is no problem!

There is another problem. If this error is reported

No Silverlight controls were detected

Introduce the Microsoft. visualstudio. testtools. UI test. extension. silverlightuiautomationhelper. dll class library to the project you want to test!

Realdigit is well studied and benefited from it. I just want to talk about it.
RelatedArticleLink: http://www.cnblogs.com/realdigit/archive/2011/02/18/1957960.html

Http://timheuer.com/blog/archive/2010/11/24/coded-ui-available-for-silverlight-4.aspx

Only to find a better site about Silverlight UI testing: http://msdn.microsoft.com/zh-cn/library/gg413374
You must share it with us immediately!

there is also a Silverlight UI testing with selenium and Ruby article (not studied): http://www.lostechies.com/blogs/louissalin/archive/2010/08/22/silverlight-ui-testing-with-selenium-and-ruby.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.