Some basic concepts and contents: Unit Tests: Test your code as a module to ensure that the module you wrote is logically correct. As long as the input value does not change, the output value should not change. Front-end automated testing:
The main content of this article focuses on interface regression testing and functional testing. These two parts of testing work are to simulate user page operations and check whether the functions are running normally by checking the changes in page status: its testing process is:
How to do front-end UI automation testing To complete front-end UI automation testing, you need at least a test framework and an assertion library. Tool selection Headless interface:
UI Testing nightwatch (simple syntax to quickly get started with the powerful Selenium WebDriver API to execute commands and assertions on DOM elements)
nightmare.js is a set of high-level APIs (very semantic: click, refresh, goto...) encapsulated for testing based on phatomJS. At the same time, nightmare is also based on electron, so it also provides GUI interface tools. When you use nightmare.js for automated testing, you can see all the simulated user actions.
Testing Framework The function of the test framework is to run the script tool written by the test developer. The test framework will capture the AssertionError thrown by the code and output it in the console or web page. The test framework provides specific test syntax, which is generally divided into two categories: TDD (test-driven development) and BDD (behavior-driven development). The test framework usually provides TDD (test-driven development) or BDD (behavior-driven development) test syntax to write test cases. TDD: means writing the test code first, and then writing the code based on the test. Its steps are generally:
BDD: Don’t test code details, but test behavior The most commonly used testing frameworks are:
Assertion Library The purpose of an assertion is to determine whether the actual execution result of the source code is the same as the expected result. If not, an error is thrown.
chai.js provides three assertion styles: assert, expect, and should. You can choose the assertion style according to your preference. For specific APIs, please refer to the relevant documentation. Using the above tools, you can basically start testing the test scripts. The following article will introduce how to use macaca to test hybrid applications. |
<<: 7 Linux command line tools you may never have heard of but are extremely useful
>>: Using macaca for mobile hybrid automation testing (Part 2)
Previously, Audi officially launched its first pu...
Siberian tundra could disappear within 500 years?...
In Beijing in spring, there are often two kinds o...
On the afternoon of November 21, the World 5G Con...
Review expert: Taozi National Psychological Couns...
Compared with the closed system of Apple iOS, And...
With the explosive growth of digital data product...
[[134718]] Microsoft's WP has a global share ...
At the just concluded Tencent 2014TGC, the author...
2016 was not a smooth year for China's color ...
In recent years, with the launch of "Mini Pr...
Author: Xu Dong, Associate Professor, School of F...
Nokia smartphones are getting closer and closer. ...
First of all, I want to emphasize that this is a ...
Platform Introduction Yidian Zixun is an interest...