pyresttest icon indicating copy to clipboard operation
pyresttest copied to clipboard

Can we get the output in the CSV/HTML format for the respective RESTful API test case

Open mravitej opened this issue 7 years ago • 1 comments

Currently, I can see the output in the command prompt as below.

  • test: # create an entity by POST
    • name: "Signin Admin User"
    • url: "/api/v1/user/login"
    • method: "POST"
    • body: '{"username": "ravi", "password": "password", "authtype": "plain"}'
    • headers: {Content-Type: application/json}
    • expected_status: [200]
    • group: "login-func"

Output: Test Group login-func SUCCESS:: 1/1 Tests Passed!

Expectation: Can we get this output in auto generated CSV/HTML file?

mravitej avatar May 16 '17 08:05 mravitej

There doesn't appear to be a flag for Pyresttest to produce CSV, HTML, or a similar kind of output like JSON. The only other thing we can call the relevant logic from a Python program.

util/pyresttest within the source code, we can see it delegates to pyresttest/resttest.py. That file contains the logic for running the tests and printing the responses. so i customized the resttest.py to print

PASS/FAIL for individual test cases Number of test cases Passed or Failed in a group The whole result will parse to test_name_file.html

Just download zip file and extract it, the resttest.py will be present . Place it in pyresttest/pyresttest directory and run following command from pyresttest directory

$ sudo python setup.py install resttest.zip

mravitej avatar Jan 04 '18 05:01 mravitej