All Projects → httprunner → Har2case

httprunner / Har2case

Licence: apache-2.0
Convert HAR(HTTP Archive) to YAML/JSON testcases for HttpRunner. Merged to httprunner/ext/har2case.

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Har2case

Yaml2go
Converts YAML specs into Go Lang type definitions
Stars: ✭ 57 (-35.23%)
Mutual labels:  yaml
Jokeapi
A REST API that serves uniformly and well formatted jokes in JSON, XML, YAML or plain text format that also offers a great variety of filtering methods
Stars: ✭ 71 (-19.32%)
Mutual labels:  yaml
Perun
A command-line validation tool for AWS Cloud Formation that allows to conquer the cloud faster!
Stars: ✭ 82 (-6.82%)
Mutual labels:  yaml
Re Txt
converts text-formats from one to another, it is very useful if you want to re-format a json file to yaml, toml to yaml, csv to yaml, ... etc
Stars: ✭ 59 (-32.95%)
Mutual labels:  yaml
Countries States Cities Database
🌍 World countries, states, regions, provinces, cities, towns in JSON, SQL, XML, PLIST, YAML, and CSV. All Countries, States, Cities with ISO2, ISO3, Country Code, Phone Code, Capital, Native Language, Timezones, Latitude, Longitude, Region, Subregion, Flag Emoji, and Currency. #countries #states #cities
Stars: ✭ 1,130 (+1184.09%)
Mutual labels:  yaml
Pytorch Project Template
Deep Learning project template for PyTorch (Distributed Learning is supported)
Stars: ✭ 76 (-13.64%)
Mutual labels:  yaml
Communityscrapers
This is a public repository containing scrapers created by the Stash Community.
Stars: ✭ 51 (-42.05%)
Mutual labels:  yaml
Graphite Metrics
metric collectors for various stuff not (or poorly) handled by other monitoring daemons
Stars: ✭ 85 (-3.41%)
Mutual labels:  yaml
Yaml
A fast, idiomatic and easy to use Clojure YAML library. Based on Snake YAML
Stars: ✭ 66 (-25%)
Mutual labels:  yaml
Jsnapy
Python version of Junos Snapshot Administrator
Stars: ✭ 81 (-7.95%)
Mutual labels:  yaml
Vim Yaml Folds
YAML, RAML, EYAML & SaltStack SLS folding for Vim
Stars: ✭ 59 (-32.95%)
Mutual labels:  yaml
Ansible In Action
Ansible playbook to deploy your Laravel code base to VPS
Stars: ✭ 61 (-30.68%)
Mutual labels:  yaml
Config Lite
A super simple & flexible & useful config module.
Stars: ✭ 78 (-11.36%)
Mutual labels:  yaml
Hiyapyco
HiYaPyCo - A Hierarchical Yaml Python Config
Stars: ✭ 58 (-34.09%)
Mutual labels:  yaml
Torchlambda
Lightweight tool to deploy PyTorch models to AWS Lambda
Stars: ✭ 83 (-5.68%)
Mutual labels:  yaml
Feedr
Use feedr to fetch the data from a remote url, respect its caching, and parse its data. Despite its name, it's not just for feed data but also for all data that you can feed into it (including binary data).
Stars: ✭ 56 (-36.36%)
Mutual labels:  yaml
Pynms
A vendor-agnostic NMS for carrier-grade network simulation and automation
Stars: ✭ 73 (-17.05%)
Mutual labels:  yaml
Django Rest Swagger Docs
Beginners approach to Django Rest Swagger
Stars: ✭ 86 (-2.27%)
Mutual labels:  yaml
Scfcli
serverless cli
Stars: ✭ 85 (-3.41%)
Mutual labels:  yaml
Mini Yaml
Single header YAML 1.0 C++11 serializer/deserializer.
Stars: ✭ 79 (-10.23%)
Mutual labels:  yaml

har2case

LICENSE travis-ci coveralls pypi version pyversions

Convert HAR(HTTP Archive) to YAML/JSON testcases for HttpRunner.

install

har2case is available on PyPI and can be installed through pip.

$ pip install har2case

usage

When har2case is installed, a har2case command should be available in your shell (if you're not using virtualenv—which you should—make sure your python script directory is on your path).

To see har2case version:

$ har2case -V
0.2.1

To see available options, run:

$ har2case -h
usage: main.py [-h] [-V] [--log-level LOG_LEVEL] [-2y] [--filter FILTER]
               [--exclude EXCLUDE]
               [har_source_file]

Convert HAR to YAML/JSON testcases for HttpRunner.

positional arguments:
  har_source_file       Specify HAR source 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.
  -2y, --to-yml, --to-yaml
                        Convert to YAML format, if not specified, convert to
                        JSON format by default.
  --filter FILTER       Specify filter keyword, only url include filter string
                        will be converted.
  --exclude EXCLUDE     Specify exclude keyword, url that includes exclude
                        string will be ignored, multiple keywords can be
                        joined with '|'

examples

In most cases, you can only specify har source file path. By default, har2case will generate testcase file in JSON format.

$ har2case tests/data/demo.har
INFO:root:Start to generate testcase.
INFO:root:dump testcase to JSON format.
INFO:root:Generate JSON testcase successfully: tests/data/demo.json

If you want to generate testcase file in YAML format, you can add -2y or --to-yml argument.

$ har2case tests/data/demo.har -2y
INFO:root:Start to generate testcase.
INFO:root:dump testcase to YAML format.
INFO:root:Generate YAML testcase successfully: tests/data/demo.yaml

The generated testcase file is in the same folder with the har source file and has the same name.

filter

You can do some filter while conversion, only url that includes filter string will be converted.

$ har2case tests/data/demo.har --filter httprunner.org

exclude

You can also set exclude keyword while conversion, url that includes exclude string will be ignored.

$ har2case tests/data/demo.har --exclude debugtalk.com

generated testcase

Generated YAML testcase demo.yml shows like below:

-   config:
        name: testcase description
        variables: {}
-   test:
        name: /api/v1/Account/Login
        request:
            headers:
                Content-Type: application/json
                User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36
                    (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
            json:
                Pwd: '123'
                UserName: test001
                VerCode: ''
            method: POST
            url: https://httprunner.org/api/v1/Account/Login
        validate:
        -   eq:
            - status_code
            - 200
        -   eq:
            - headers.Content-Type
            - application/json; charset=utf-8
        -   eq:
            - content.IsSuccess
            - true
        -   eq:
            - content.Code
            - 200
        -   eq:
            - content.Message
            - null

And generated JSON testcase demo.json shows like this:

[
    {
        "config": {
            "name": "testcase description",
            "variables": {}
        }
    },
    {
        "test": {
            "name": "/api/v1/Account/Login",
            "request": {
                "url": "https://httprunner.org/api/v1/Account/Login",
                "method": "POST",
                "headers": {
                    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
                    "Content-Type": "application/json"
                },
                "json": {
                    "UserName": "test001",
                    "Pwd": "123",
                    "VerCode": ""
                }
            },
            "validate": [
                {
                    "eq": [
                        "status_code",
                        200
                    ]
                },
                {
                    "eq": [
                        "headers.Content-Type",
                        "application/json; charset=utf-8"
                    ]
                },
                {
                    "eq": [
                        "content.IsSuccess",
                        true
                    ]
                },
                {
                    "eq": [
                        "content.Code",
                        200
                    ]
                },
                {
                    "eq": [
                        "content.Message",
                        null
                    ]
                }
            ]
        }
    }
]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].