One 、 Preface : It took a while for the interface automation testing framework encapsulated a while ago to find that there are still many drawbacks , At present, it has been improved , It can be said that the whole idea has been overthrown , It is much more powerful than before , If you are interested, please send me a private letter to communicate with you alone , Hope to learn and make progress together !
Two 、 Project directory
case Catalog : Store test execution files
config Catalog : Store the configuration file ( Database connection information 、token Information, etc )、 Temporarily stored files ( You need to extract the fields of the interface to use )
data Catalog : Store test case data files
files Catalog : Store accessories ( The upload interface requires )
log Catalog : Store the generated log file
logs Catalog : Encapsulated logs
report Catalog : Deposit allure Test report
utils Catalog : Secondary packaging requests、 Database connection 、 Assertion 、 General methods, etc
conftest.py: Method to perform initialization , This is mainly when the test case collection is completed , What will be collected item Of name and nodeid The Chinese language of is displayed on the console
main.py: The main entry of the program
pytest.ini: To configure pytest Test the rules executed by the framework
readme.md: Some descriptions of interface automation test framework
requestsirements.txt: Some third-party libraries that need to be installed
3、 ... and 、 The core idea ( Use a specific example to illustrate ):
First, execute case Test cases in the directory py file , Then read the corresponding data Test cases maintained under , And then call utils Lower encapsulated requestUtil class , Execute check_case().requestUtil Under the package request、 assert methods . See the screenshot code for details . The general idea is like this , Please study by yourself .
For special reasons , Some screenshots are incomplete , You can use your ideas for reference , No need to copy .
Check out the full article and click on the original link : pure python Self developed interface automation script update version , Let Xiaobai also realize 0 To 1 ten thousand + Interface automation use case for Are you still using postman\jmeter Do interface automation ? use python Open source framework of [unit ...
background I wrote a blog before , How to use Python By parsing the packet capture data , Complete the writing of automation use cases . Recently, I have been using go test, So I wonder if I can also use code to generate automation use cases , Quickly improve the coverage of test cases . Do as you say . ...
Jmeter There are many articles on how to use , But how to organize test cases , It's almost hard to see . In this article , I will put Jmeter Let's share some experience on how to organize test cases , I hope I can give you some help or enlightenment . 1. Make good use of “ Logic controller ” Medium “ Simple ...
After the previous study , We try to make use of pytest Framework to write an interface automation test case , To clarify the idea of writing interface automation use cases . We search the weather query on Baidu , The results shown in the figure below will appear : Next , Let's take the weather query interface as an example , Write connection ...
from https://my.oschina.net/u/3041656/blog/820023 Abstract : python + requests Implementation of the interface automation framework detailed tutorial Some time ago, due to the transformation of the company's testing direction , from ...
Some time ago, due to the transformation of the company's testing direction , From the original web Turn page function test into interface test , Most of them were done by hand before , utilize postman and jmeter Interface tests performed , later , Someone in the group said that web The automated testing framework moves to the self-contained interface ...
background Because of the migration of services ,Jira Version update , Many interface documents are less maintained , This makes it particularly troublesome to write automated tests for some services , A lot of services , In particular, the client interface needs to query parameters by capturing packets to write automatic use cases , But the process is repeated manually ...
One . Encapsulation method 1. How programming gets faster and faster : First , It takes experience , A wide range of knowledge . secondly , Every skilled programmer , Every city has its own library , Solve all kinds of problems . Various general methods and functions . Empathy , Automated scripts are also programming , Test cases are requirements ,U ...
background Although everyone has used a unified keyword , But after checking some test cases , Or is it because people are interested in RF Different familiarity of test cases leads to different granularity of test cases : And in the process of manually transforming test cases , A lot of work is completely repetitive and ...
Contents of this article 1. Run all the test cases 2. Run a single test class or a TestSuite 3. Run a test method in a test class 4. Run two different test classes or methods in classes Command line run Android Robotium Automatically ...
The first requirement is based on A Field to sort , The sort result is updated to B Field After a simple search , It's a quick answer http://dev.mysql.com/doc/refman/5.7/en/update.html ; ) ORDE ...
One . Install... On a virtual machine ubuntun 13.04 Chinese version Of course , If you are used to reading English version , You can also install the English version directly . Just download and install it from the official website , Installing the system is not the focus of this article . Here's just one caveat : Before novice installation , Remember to cut the net , because ...
1. Add the common code of timer - (void)delayEnableTabButton { self.tabChannelButton.enabled = NO; [self appendTimer]; ...
document.getElementById("zx"); adopt ID obtain html Element object ,ID The number is html It should be unique in the document . The returned is the only element object . And all browsers are concurrent ...
In the south central United States 2008R2 Of A1 Of VM For a day ,CPU Time goes up 13 Hours , It's a little expensive , There is really no operation ... Prompt in the morning 7 To 9 There is a small peak at . It seems that there is little traffic at ordinary times , Or change it to A0 Can you save some money . Because the first day was with A0 ...
sql If you want to group queries , It's usually used to group by sentence , How to skillfully use group by Sentence? , I will summarize it in the following points . Group by And aggregate functions Group by And Having What to pay attention to Gr ...
A class is an abstract description of a group of objects with common characteristics and behaviors . understand [1] Classes are designed to describe things in real life . [2] Classes describe things that have common characteristics and behaviors . [3] Class is what we usually call “ type ” , It describes a group ...
By setting the timer , Let the timer Tick Event simulation to MessageBox Send a Enter Button instead of clicking with the mouse MessageBox OK button on the , To achieve MessageBox Automatic shutdown of , The implementation code is as follows : System ...
Avoid entering the pit : 1. Error message numClasses must be at least 2 Probably, the data classification of training model must be two kinds , Following mistakes : The correct data set is as follows :
We often linux To find a file , But I don't know where it is , You can use some of the following commands to search for : which View the location of the executable . whereis Check the location of the file . ...