Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Principles of automated use case design

Shulou Source: shulou.com Published: 2022-06-03 05:52:49 09月30日 Update

1. Automation Use Cases in 3 Steps

Initialize, input ready

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 execution of the use case is consistent with the state after the execution of the use case

3. single responsibility

A single test case is responsible for only one scenario/behavior

Multiple assertions in a use case validate only one scenario

For example: call api return results need to verify whether error no is 0, error msg is empty

One method, N scenarios need to write N use cases

A scenario, multiple methods can write a use case

The principle followed is that one scenario corresponds to one use case

4. self-describing

Variable names, method names, class names, etc. should be designed to be readable and easy to understand

The test points can be identified by their names

5. full-automatic

Because use cases are executed frequently in lieu of manual testing to reduce effort, case reliability is guaranteed.

The case should contain four elements:

test execution

result collection

result judging

result notice

6. atomicity

There are only two types of PASS and FAIL for single test case execution results

One case FAIL, whole test suite FAIL

There is no intermediate state of half pass

Tags: Result scenario method test state validation multiple environment principle automation design different same frequent consistent fully automatic atomic variable only reliability Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Information MySQL MariaDB Apple