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)
Author: Tang Yuhan, Associate Professor of Nutrit...
October, a month of long holidays and busyness, i...
Mixed Knowledge Specially designed to cure confus...
The school season is about to begin, and the camp...
If we follow Google's usual tradition, inform...
Expert of this article: Song Yingwei, Chief Techn...
© The Good Men Project Leviathan Press: “You will...
This is the 4373rd article of Da Yi Xiao Hu Sleep...
The scorching sun and high temperatures are a gre...
How much does it cost to develop a textbook apple...
In the past two days, I have watched more than 1,...
Retention is considered to be an advanced indicat...
Not long ago, Zhihu announced that the total numb...
This year's Apple WWDC Global Developer Confe...
Qian Sanqiang, a nuclear physicist, is the founde...