Detailed explanation in one article! Interface testing API automated testing framework

Table of contents

foreword

frame positioning

Framework diagram

Framework introduction

technology stack

Case display

executive show

Framework advantages:


foreword

Interface testing API automated testing framework can improve testing efficiency and automation, usually including HTTP client, test data management, test report generation, test case management and scheduling and other functions. The following is the basic architecture of a commonly used API test automation framework:

frame positioning

  • Data-driven design patterns can be automated without writing test code scripts;

  • Equivalence class non-equivalence class coverage, E2E (interface flow testing) Case coverage;

  • Use Excel to write automated use cases, which is simple, easy to use, and efficient.

Framework diagram

Framework introduction

technology stack

Jenkins + Svn + Maven+TestNG+ReportNG+(HttpClien+URLConnection)

Case display

1. Single Interface Case

The Json response analysis uses the JsonPath analysis method, and the checkpoints are separated by ","

2. E2E Process Automation Case

Among them, the parameters in the response of the above Step can be used as the input parameters of the following steps or to check the expected values.

executive show

First configure the use case script template:

Configure the global environment configuration:

Jenkins configures tasks and executes them to get automated test reports

Mail report:

testing report:

  • task overview

  • Step process print:

Values ​​and assignments can be made between interfaces according to the specified parameters, and the data center alone controls whether the traversed interfaces need data conversion! ~

In this way, some simple API business flows can be stringed together for continuous integration, which is convenient for rapid iteration~!

Framework advantages:

1. Writing Case Efficiency

  • Easy to write, writing and pasting in Excel is very simple and convenient, and global replacement is also very convenient.

  • Easy to maintain, no need for everyone to write code scripts, and the maintainability in the use case template is much higher.

  • Easy handover, automation templates can basically be understood, and the ideas are clear at a glance.

2. Execution efficiency

3. Support parameter definition between interfaces (need to use definition parameters)

4. HTTPCode will report an error if the status is abnormal!

(Only wrong addresses will appear in the test report)

  • Example report details:

5. Response timeout warning email trigger:

  • A single interface responds for more than 5 seconds to automatically trigger the code to send an email to the designated person

6. Global parameter variables

  • The specified parameter TTPod_Rondom(20) will automatically replace the code with a random number within the range of 0~20 during execution

7. The framework is light and flexible, seamlessly connected to continuous integration and continuous delivery

It is very simple to build a continuous integration link with TestNG +Maven+Jenkins.

As someone who has been here, I also hope that everyone will avoid some detours, and I hope it can help you. (WEB automated testing, app automated testing, interface automated testing, continuous integration, automated test development, big factory interview questions, resume templates, etc.), I believe it can make you better progress!

Just leave [Automated Test] [Automated Test Communication]: 574737577 (remark ccc) http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=eSv73sPKaVXpq9JeRq1Kboh1D-w19xXu&authKey=Qs1Sduo9tp2wfkOYvRyyFCoblyT7fBh H4PPisEb1G63n1UckS6wQU50e9ar1LAOz&noverify=0&group_code=574737577

Guess you like

Origin blog.csdn.net/DJ355/article/details/131153727