Lightweight test automation framework is ASP. the automated integration testing framework developed by the net QA Team and applied in ASP. net QA Team's automated testing product, the latest version is megal update. The role of this framework is similar to that of watin and selenium.ProgramCompile a regression test. According to lightweight test automation framework release l release published on the ASP. net qa Team blog, this version mainly fixes bugs and adds some new features. The main features are as follows:
- Improvement on the user interface: highlight failed test cases by enlarging the case name and different colors, and there is a "run failed tests" button to separately run failed test cases.
- Automated test pop-up window: the pop-up window cannot be tested in earlier versions. Compared with watin and selenium, the pop-up window is hard to be tested. in the unit test of the view in the. net mvc project, this is an irreparable disadvantage. This version makes up for this defect.
- Some attribute values can be found: Previous versions can only be searched through the ID attribute. This version can be searched through the attribute.
Introduction to the advantages of lightweight test automation frameworkArticleTo describe:
- Because it runs directly in a browser, it naturally supports existing-and any browser that may appear in the future.
- Because it is directly deployed on the tested websiteCodeIt is in the same process as the website page.
The first advantage is not worth mentioning, and the second is the key. Imagine that watin and selenium both open the page by writing code in the browser. This means that our testing code and the tested webpage are in different processes. Under this premise, if we want to pass the data defined in the test code to the tested webpage (that is, the view object), we must conduct cross-process communication. No matter how it is implemented, it cannot escape the "serialization" path, which undoubtedly increases the complexity. After LTAF is used, this problem instantly disappears, because we can "pass" the test data directly in the memory, and everything is just a reference.
How does it work?
You can use C # (any.. Net Language) Write test cases. Each test case is very similar to a traditional unit test. Write a series of test commands (for example, jump to the URL, click the button, get the content, and check the text content ). Unlike nunit GUI or Visual Studio's built-in unit test runner, the test automation framework runner is a browser (any browser), and every command is run in Ajax mode. All you need to do is addTestsFolder, which contains two pagesDefault. aspxAndDriverpage. aspx,Is its working principle:
When testing,Testcaseexecutor. jsThe running result is highlighted. Green indicates pass, and red indicates an error.
How to Apply lightweight test automation framework in the Asp.net MVC Project
The ASP. net qa Team said that lightweight test automation framework was designed for "Asp.net". Now Asp.net MVC is added to Asp.net. From experience, lightweight test automation framework does not support Asp.net MVC by default. Fortunately, Asp.net MVC and webform can be used together. All you need to do is modify the routing settings and avoid some Asp.net Ajax-dependent functions.
First download lightweight test automation framework release L update and then. web. testing. lightweight. DLL references to the project, create a directory test under the site of the MVC project, modify routing of lightweight test automation framework, and add the following code
Routes. ignoreroute ("test/{resource}. axd/{* pathinfo }");
References:
Using lightweight test automation framework
Perform unit tests on views in ASP. net mvc projects.