Giter Site home page Giter Site logo

postman2case's Introduction

postman2case

LICENSE Build Status coveralls

Convert postman data to JSON testcases for HttpRunner.

usage

To see postman2case version:

$ python main.py -V
0.0.1

To see available options, run

$ python main.py -h
usage: main.py [-h] [-V] [--log-level LOG_LEVEL]
               [postman_testset_file] [output_testset_file]

Convert postman testcases to JSON testcases for HttpRunner.

positional arguments:
  postman_testset_file  Specify postman testset file.
  output_testset_file   Optional. Specify converted JSON testset file.

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show version
  --log-level LOG_LEVEL
                        Specify logging level, default is INFO.

examples

In most cases, you can run postman2case like this:

$ python3 main.py test/test.json output.json
INFO:root:Generate JSON testset successfully: output.json

As you see, the first parameter is postman source file path, and the second is converted JSON file path.

The output testset file type is detemined by the suffix of your specified file.

If you only specify postman source file path, the output testset is in JSON format by default and located in the same folder with source file.

$ python3 main.py test/test.json
INFO:root:Generate JSON testset successfully: test/test.output.json

generated testset

generated JSON testset output.json shows like this:

[
    {
        "test": {
            "name": "/api/v1/Account/Login",
            "request": {
                "method": "POST",
                "url": "https://httprunner.top/api/v1/Account/Login",
                "headers": {
                    "Content-Type": "application/json"
                },
                "json": {
                    "UserName": "test001",
                    "Pwd": "123",
                    "VerCode": ""
                }
            },
            "validate": []
        }
    }
]

postman2case's People

Contributors

hluguoj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

postman2case's Issues

UnicodeEncodeError: 'latin-1' codec can't encode chinese

  • OS:Windows
  • Python 3.6
  • HttpRunner 2.0
    when the request contains chinese, I got the error massege as following. how can I fix it?

Traceback (most recent call last):
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 17-18: Body ('上海') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.


Ran 1 test in 0.004s

求使用说明文档

目前有postman用例转httprunner用例的需求,求说明文档!谢谢!!!^_^

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.