1. The automation use case is divided into 3 steps.
Initialize, enter prepare
Execution (method call), result validation (assertion)
Clean up the environment
2. Use case Independence
Different execution order, same result
No state sharing between use cases
The state of the environment before the use case is consistent with the end of the use case execution
3. Single responsibility
A single test case is responsible for only one scenario/behavior
Multiple assertions in a use case validate only one scene
For example: Call API return results need to verify if error no is 0,error msg is empty
One method, n scenarios need to write n use cases
A scenario where multiple methods can write a use case
The principle followed is that a scenario corresponds to a use case
4. Self-description
Variable name, method name, class name, etc. should be designed easily readable, easy to understand
The test point can be seen by name
5. Fully Automatic
Because use cases are frequently executed in lieu of manual testing to reduce workload, ensure case reliability
The case should contain four elements:
Test execution
Result Collection
Result judgment
Results announcement
6. atomicity
Single test case execution results only two pass and fail
A use case fail, the entire test set fail
There is no intermediate state of the half pass
This article from "Today's efforts, tomorrow's success!" "Blog, be sure to keep this provenance http://zhzhgo.blog.51cto.com/10497096/1692068
Automation use case design principles