Giter Site home page Giter Site logo

vivian's Introduction

vivian

vivian is a multi thread CLI for veirfying a large number of URLs redirection. It's easy to integrated with CI in smoke or regression test.

Installation

pip3 install vivian

or

pipenv install vivian

Usage

You can load a large number or URLs redirection pair from a .csv file. Like this example.csv:

http://www.github.com, https://www.github.com
http://www.google.com, https://www.google.com.hk

Then you can virify the url pairs via vivian:

vivian -f example.csv

And you will get these output:

load test case from example.csv
2 cases loaded running in 2 threads
verifying http://www.github.com
verifying http://www.google.com
FAIL:{'status_code': 200, 'origin_url': 'http://www.google.com', 'expect_url': 'https://www.google.com.hk', 'dist_url': '', 'redirect_count': 0, 'is_match': True, 'is_pass': False, 'auth': {}, 'err_msg': ConnectionError(MaxRetryError('None: Max retries exceeded with url: / (Caused by None)',),)}
1/2 PASS in 75.46944499015808 seconds

here is the explaination for the output:

status_code: the http status code of last request. origin_url: the url you request in the file. expect_url: the url you expect in the file. actual_url: the destination url you get when you made a url request. redirect_count: how many redirection happened when you request from origin url. is_match: if expect_url is same as dist_url, this value would be True, else it will be False. is_pass: if the last request http status code between 200 to 399 and is_match is Ture, this value would be True, else it will be False.

Best Practices

TDD for Redirection

Before you write url rewrite rules in nginx.conf or .htaccess, you can write the rules as test cases in the .csv. The flow will be like Green-Red-Green in a TDD style. It is a good way to protect your exsisting http server configure and you can refactor the configure with fully confidence.

Integrated with CI Server

You can keep the test case file as in your codebase as regression test or smoke test after deploy or changed http server congiuration.

License

MIT License

vivian's People

Contributors

wizardbyron avatar yuanleihong avatar hongyuanlei avatar

Watchers

 avatar

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.