Cypress
Introduction to the
Cypress is a testing tool that runs in a browser. Web technology continues to evolve, as does testing technology.
Can do
- End to end testing
- Integration testing
- Unit testing
Important features
- Timing Travel Visual test run
- Browser-based debugging is especially easy
- Automatic waiting
- Handy spyware, stubs and timer tools
- Easy flow control
- Consistent results
- Simple screenshot/video function
- Multi-browser support
Daily development of the test task, its basic functions have. With it, we can perform test-related tasks on familiar browsers.
Test in four steps
- Set up the test
- Write the test
- Run the test
- Commissioning test
Quick start
Dependencies and Installation
- cypress
- chrome/firefox/… The browser
cd your_project_name && yarn add cypress
Copy the code
Use cypress Open to open the Cyress opening tool
{
"scripts": {
"cy:open": "cypress open"}}Copy the code
After running the NPM script, the word Verifying Cypress can run XXX appears, and a Cypress configuration file is generated under the further directory of the project. The structure of the directory is as follows:
. ├ ─ ─ fixtures │ └ ─ ─ example. The json ├ ─ ─ integration │ └ ─ ─ examples │ ├ ─ ─ actions. Spec. Js │ ├ ─ ─ XXX... ├── └─ support ├─ moves.jsCopy the code
Cypress’s visual operation interface
There are many official examples available in the integration TESTS/ Examples file
summary
- Know what Cypress is and what it can do
- How to use NPM to operate Cypress easily
The next step
- Using Cypress test cases, the combination of features and test cases
- Familiar with APIS, write simple test cases