Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Principles of automated use case design

2025-02-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report