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)
As the current leaders in short video, Tik Tok an...
This winter is particularly cold. Various places ...
When we talk about station wagons, we often add k...
Once upon a time, I was superstitious about conve...
In recent years, mobile Internet has developed ra...
[[149041]] “A churchman without empathy” That’s w...
The annual Arbor Day is here again. On this speci...
Introduction: In Internet companies, any APP must...
Doing SEO is about taking advantage. If you do SE...
Ancient eclipse records reveal changes in Earth...
Qualcomm has released a report titled “What is th...
Without further ado, the full article is structur...
[[330468]] Currently, from mobile phone manufactu...
A comprehensive business research and intelligenc...
After being completely banned by Tencent WeChat, M...