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)
Renault Group, Dongfeng Renault Automobile Co., L...
Why does the traffic increase when users are mock...
When it comes to H5-related sound effects, many p...
Your browser does not support the video tag What ...
Ginkgo seems to be a very common and ordinary pla...
For entrepreneurs, although mini program developm...
In fire rescue, Firefighters will adopt different...
Glaciers are the "royalty" of nature Th...
When user characteristics are strong, fine-graine...
Hello everyone, this is the 5th issue of the Envi...
When we mention "design specifications"...
This update of the WeChat public platform has add...
[[121542]] There are many articles and blogs that...
Last month, Samsung announced that it would launc...
Regulators take measures to regulate live broadca...