Requirements Analysis - Python interface to automate real - Python interface to automate the actual needs analysis

Reprinted: https://www.cnblogs.com/testjiali/p/10411944.html

Python interface to automate real - needs analysis

 

Preface:

With the rapid iteration of products, automated testing has become almost every testers must master the basic skills. We all know that products in the development stage is not suitable for automation, but when the product stable state, generally does not change the basic functions, automated testing will begin to highlight his advantage.

This work has been several months doing product (web end, Android, Ios) a real-time communications, product iterations quickly, updated twice a week. Each release version, it is necessary to ensure the basic function is normal, what we call regression testing, so I decided to build himself an interface automation framework to address two issues I currently experiencing:

1) conduct smoke tests before submitting the development of new interfaces to ensure that the system is able to carry out the normal testing

2) complete functional test / bug regression after regression testing is complete, to ensure that no new issues introduced after the completion of bug fixes

With this in mind, it will begin operations next few months will study and record the development process, can be considered one of his small combat it.

1. The purpose of the test

With the continuous increase in the company's projects, services, interfaces increase, the task of increasing the amount of return, the need for an interface timing regression testing to ensure the stability of the system.

       1) conduct smoke tests before submitting the development of new interfaces to ensure that the system is able to carry out the normal testing

       2) complete functional test / bug regression after regression testing is complete, to ensure that no new issues introduced after the completion of bug fixes

 

2. Test Method

Our current http protocol interfaces are used, the basic principle of the test is to simulate the front end (client) sends data to the server, the corresponding response data, to determine whether the interface can be a normal data exchange.

According to access the address provided by the developer interface to the Senate format, the request format, interface request data stitching and view returns the results and return the message, response time, check the return Json content meets the interface definition specification is consistent with the expected return results .

3. testing framework implementation process

The first stage:

1) based on the python unittest framework, completion request of a single interface, and packaged as such

2) add exception handling

The second stage: to achieve the separation of data and code

1) test case design: the specific test ideas mentioned in the fourth chapter

2) excel in which test data, read data using openpyxl

3) will read out what type of test data to store? -dictionary

4) parametric test data? -ddt

5) write-back test results and actual results

The third phase:

1) of the configuration example may be implemented

2) log design, so that each step of the operation has tracked

3) generate test reports -HTMLReport

4) implement continuous integration - jenkins

The frame structure is as follows:

4. Test ideas

The first interface document, a clear understanding of the interface corresponding to the measured, the parameters, the parameters and the return Json specification data structure, tested according to the test scenario.

1) interface parameters understood, familiar interface parameters input requirements, range of input values, and the like required;

2) interface output appreciated, the structure returns json familiar configuration, the return value of the category, the range of the return value, to return different types of data.

3) understand the logic interface, the service interfaces associated with the interface interrelated familiar aspect, the dependency relationship between the interfaces and data transfer interface.

4) Find test points, according to an input (parameter name, range), the output (parameter name and returns a value range), relationships, test point analysis.

4.1 normal scenario testing

According to the strict definition of the interface documentation, and provide the correct parameter name and, if properly test interface

4.2 abnormal test scenario

1) length restrictions: as registration, less than or greater than 11 input phone number

2) Required judgment: necessary parameter is empty, such as login time, without entering a password

3) Analyzing data types: int type passed as required, the results of a string type passed

4) determine the correctness of the data: such as when logging in, the wrong phone number

5) Repeat value determination: The registration user name, enter an existing

4.3 logical scenario testing

4.4 assertion checks

Check interface request returns the expected results of the results: The status code, the database is determined, the data values, etc.

Specific assertion checking business scenarios need to be set

Preface:

With the rapid iteration of products, automated testing has become almost every testers must master the basic skills. We all know that products in the development stage is not suitable for automation, but when the product stable state, generally does not change the basic functions, automated testing will begin to highlight his advantage.

This work has been several months doing product (web end, Android, Ios) a real-time communications, product iterations quickly, updated twice a week. Each release version, it is necessary to ensure the basic function is normal, what we call regression testing, so I decided to build himself an interface automation framework to address two issues I currently experiencing:

1) conduct smoke tests before submitting the development of new interfaces to ensure that the system is able to carry out the normal testing

2) complete functional test / bug regression after regression testing is complete, to ensure that no new issues introduced after the completion of bug fixes

With this in mind, it will begin operations next few months will study and record the development process, can be considered one of his small combat it.

1. The purpose of the test

With the continuous increase in the company's projects, services, interfaces increase, the task of increasing the amount of return, the need for an interface timing regression testing to ensure the stability of the system.

       1) conduct smoke tests before submitting the development of new interfaces to ensure that the system is able to carry out the normal testing

       2) complete functional test / bug regression after regression testing is complete, to ensure that no new issues introduced after the completion of bug fixes

 

2. Test Method

Our current http protocol interfaces are used, the basic principle of the test is to simulate the front end (client) sends data to the server, the corresponding response data, to determine whether the interface can be a normal data exchange.

According to access the address provided by the developer interface to the Senate format, the request format, interface request data stitching and view returns the results and return the message, response time, check the return Json content meets the interface definition specification is consistent with the expected return results .

3. testing framework implementation process

The first stage:

1) based on the python unittest framework, completion request of a single interface, and packaged as such

2) add exception handling

The second stage: to achieve the separation of data and code

1) test case design: the specific test ideas mentioned in the fourth chapter

2) excel in which test data, read data using openpyxl

3) will read out what type of test data to store? -dictionary

4) parametric test data? -ddt

5) write-back test results and actual results

The third phase:

1) of the configuration example may be implemented

2) log design, so that each step of the operation has tracked

3) generate test reports -HTMLReport

4) implement continuous integration - jenkins

The frame structure is as follows:

4. Test ideas

The first interface document, a clear understanding of the interface corresponding to the measured, the parameters, the parameters and the return Json specification data structure, tested according to the test scenario.

1) interface parameters understood, familiar interface parameters input requirements, range of input values, and the like required;

2) interface output appreciated, the structure returns json familiar configuration, the return value of the category, the range of the return value, to return different types of data.

3) understand the logic interface, the service interfaces associated with the interface interrelated familiar aspect, the dependency relationship between the interfaces and data transfer interface.

4) Find test points, according to an input (parameter name, range), the output (parameter name and returns a value range), relationships, test point analysis.

4.1 normal scenario testing

According to the strict definition of the interface documentation, and provide the correct parameter name and, if properly test interface

4.2 abnormal test scenario

1) length restrictions: as registration, less than or greater than 11 input phone number

2) Required judgment: necessary parameter is empty, such as login time, without entering a password

3) Analyzing data types: int type passed as required, the results of a string type passed

4) determine the correctness of the data: such as when logging in, the wrong phone number

5) Repeat value determination: The registration user name, enter an existing

4.3 logical scenario testing

4.4 assertion checks

Check interface request returns the expected results of the results: The status code, the database is determined, the data values, etc.

Specific assertion checking business scenarios need to be set

Guess you like

Origin www.cnblogs.com/yuany66/p/11387790.html
Recommended