Opening a page in a browser and judging it is undoubtedly the most direct way to test a Web application. With a suitable automated test tool or framework, testers can be freed from heavy manual testing to some extent. Watir, a ruby platform, is undoubtedly the jiao, and is therefore heavily used for regression testing or acceptance testing of Web applications. But for technical teams using the. NET Framework, Watir is not necessarily the best choice. There are already several in the community. NET platform, testers can now use their most familiar language to achieve the same functionality and seamlessly integrate with their development environment.
Watin
Watin is Watir's "coping", developed using the C # language, but can be used arbitrarily. NET language to write test code. Watin 1 only supports IE browser, but starting from the 2.0 version can also automatically operate Firefox (need to install plug-ins) browser. The latest version of the 2.0 CTP3, released February 19, enhances Firefox-oriented functionality and modifies bugs. Its affiliate project Watin Test Recorder supports capture of browser operations and automatically generates test code. Watin Test Recorder has just released an alpha version, and you can follow up on its home page for the latest news. Watin is an Open-source project, published using the Apache License 2.0 protocol.
Selenium
Strictly speaking, Selenium is a complete set of Web application test systems that include the recording of tests (Selenium IDE), authoring and running (Selenium Remote control), and parallel processing of tests (Selenium Grid). The core of selenium, based on Jsunit, is written entirely by JavaScript and can run on any JavaScript-enabled browser.
The Selenium core is driven by a format-specific HTML file, which enhances the readability of test suites to some extent. Selenium Remote control allows testers to write test code in common languages, such as C # and so on, and to support a variety of mainstream browsers under different operating systems. The role of Selenium grid is to distribute tests to at most machines, which can greatly speed up testing. Like Watin, selenium is also an open source framework that uses the Apache License 2.0 protocol.
Ltaf
Lightweight Test Automation Framework for ASP. NET (lightweight asp.net Automated test framework, hereinafter referred to as LTAF) is a framework developed by the ASP.net QA team and is used for regression testing of products. Testers can use arbitrary. NET code to write tests and use the built-in APIs to manipulate DOM elements. LTAF recently released the April update and included the framework code, which records how the framework is used. Zhao recently spoke in a blog about using LTAF to make independent unit tests of views in asp.net MVC applications, which he commented on Ltaf in the article:
While in some ways (such as the selection of DOM elements) are inferior to their "competitors", LTAF has its own uniqueness:
Because it runs directly in the browser, it naturally supports existing-and any future browsers that might appear.
The test code and site pages are in the same process because they are deployed directly in the tested Web site.
The 1th advantage is needless to say, and the 2nd is the key. Imagine Waitn and selenium, all by writing code to open the page in the browser. This means that our test code and the pages being tested are in separate processes. In this context, if we were to pass the data defined in the test code to the tested Web page (that is, the View object), we would have to communicate across processes. However, no matter how the implementation, can not escape the "serialization" of a path, which undoubtedly increased the complexity. After using LTAF, the problem vanished instantly, because we could "pass" the test data directly in memory, and everything was just a reference.
But everything has two sides, LTAF also have some difficult to be born, and can never make up for the shortcomings. For example:
Because Ltaf places the page to be tested in a frame, the properties of the browser-based frame structure such as window.top on the page are changed.
Because the essence of LTAF is using JavaScript to manipulate the DOM, this means that any action that blocks the program (such as alert) cannot be used, or it will block the entire test process.
Fortunately, these two points will not be a serious problem. For the first case, we just need to write a custom GetTop method to replace the direct access windows.top. In the second case, Zhao never liked the "pure browser" feature of alert or confirm, because they had a bad user experience, not to mention the fact that JavaScript libraries/frameworks can now easily do so, don't you think?
Comparison
Although Old Zhao recommends using LTAF, however, which test framework is best for your project, the reader needs to make a judgment according to their needs. The following table lists their horizontal comparisons.
Framework |
Watin |
Selenium |
Ltaf |
Browser support |
Ie/firefox |
Ie/firefox/opera/safari |
Any |
Generate code automatically |
There is, but currently does not support Firefox browser |
58.9 |
No |
Open Source Protocol |
Apache Licence 2.0 |
Apache Licence 2.0 |
Not open source, but publish code |
Other |
/ |
Test can be distributed across multiple machines to speed up |
Test code is in the same process as the Web site |