Python Interface Automation Test (i)-Environment preparation

Source: Internet
Author: User
Tags virtual environment virtualenv

Python in the HTTP protocol interface related libraries have URLLIB,URLLIB2 and Reqeusts library, which Reqeusts library for the most convenient, so I also mainly use the requests library to do the interface test HTTP protocol. Let's start by looking at what environment information is needed:

First, install Python

The Mac comes with Python installed, and that's not much to say.

Second, install the virtual environment:

We can install multiple versions of Python on a single machine, so we can install the virtual environment to keep each version of the environment from interfering with each other:

1, installation Virtualenv:pip install Virtualenv

2. Create a new virtual environment named Venv: Virtualenv venv

3. Enter the new environment: source Venv/bin/activate

4. Exit: Deactivate


Third, install requests library:

>>>PIP Install Requests

This library is used for interface testing of HTTP protocols using Python.

Iv. HTTP Test Tools:

An HTTP request and response service written using Python + Flask, which is primarily used to test HTTP libraries. Follow-up tests are based on this site.

http://httpbin.org/

Five, the local construction Httpbin:

Considering the testing to continue to visit the Httpbin website, request too much worry to be pulled to the blacklist, we build a set of Httpbin service in this blog.

1. Installation: Pip install Gunicorn

2. Installation: Pip install Httpbin

3, start: Gunicorn Httpbin:app

At this point, the environment has been completed, you can start to play ~

Python Interface Automation Test (i)-Environment preparation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.