Automation use case design principles

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.