In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "the summary of knowledge points of interface testing". In the daily operation, I believe that many people have doubts about the summary of knowledge points of interface testing. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts of "knowledge point summary of interface testing"! Next, please follow the editor to study!
Python coding for interface testing steps
We take the http interface sent by python as an example to test the http interface through requests module in python. The specific steps are as follows:
Step 1: build the interface
Install pip install requests
Build a mock interface in rap2 (you can register rap2 yourself and build your own rap2 interface) http://rap2api.taobao.org/app/mock/85630/getinfo
The response values of the defined interfaces are as follows:
Step 2: send interface
The core code is as follows:
Import requests req= "http://rap2api.taobao.org/app/mock/8563/getinfo" response=requests.get (req) print (response.text) output: {" code ": 0," message ":" ok "}
Step 3: verify the interface
Because the code generation rule defined in the build interface is 0-10, we need to verify it. Because the response data is in json format, we also need to use the json module to parse the response. The specific code is as follows:
Import json import requests req= "http://rap2api.taobao.org/app/mock/85630/getinfo" response=requests.get (req) print (response.text) # parses the response code as follows: code=json.loads (response.text) .get ('code') print (code) if code
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.