程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python+requests+yaml implementation of interface automation use case (2) -- upgraded version

編輯:Python

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 .

python+requests+yaml Implement interface automation use cases ( Two )--- More articles on the upgrade

  1. pure python Self developed interface automation script update version , Let Xiaobai also realize 0 To 1 ten thousand + Interface automation use case for

    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 ...

  2. 【Golang】 Based on recording , Automatic generation go test Interface automation use case

    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 . ...

  3. Jmeter Use it : Techniques for organizing interface automation use cases efficiently

    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 ...

  4. python+pytest Interface automation (12)- Automatic use case writing ideas ( Use pytest Write a test script )

    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 ...

  5. Reprint :python + requests Implementation of the interface automation framework detailed tutorial

    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 ...

  6. python + requests Implementation of the interface automation framework detailed tutorial

    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 ...

  7. 【Robot Framework Project practice 04】 Based on recording , Generate RF Keywords and Automated use cases

    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 ...

  8. Android UI Automated use case design techniques

    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 ...

  9. 【Robot Framework Project practice 03】 Use scripts to automatically generate unified format RF Automated use cases

    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 ...

  10. Command line run Android Robotium Automation case or unit test case

    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 ...

Random recommendation

  1. MySQL Update grouping sort with user variables

    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 ...

  2. ubuntu13.04 Environmental Science hadoop1.2.1 Stand alone mode installation

    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 ...

  3. iOS Summary of development skills

    1. Add the common code of timer - (void)delayEnableTabButton { self.tabChannelButton.enabled = NO; [self appendTimer]; ...

  4. JS obtain html Object in several ways

    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 ...

  5. Azure billing analysis (2)

    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 ...

  6. Group by How to use

    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 ...

  7. java The object-oriented that Xiaobai can understand

    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 ...

  8. Set up MessageBox Automatically shut down

    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 ...

  9. .net ML Machine learning encounters error records

    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 :

  10. One a day linux command ( File operations ):【 Reprint 】which command

    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 .         ...


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved