tcli is a test client to help interact with services via openapi spec files.
For general build and run instructions, please see how to build and run
- Data driven modules.
- Customize test flows with context sensitive modules.
- Api specs driven by openapi.
- Create similar config for all test interactions.
- Integrated
jqviagojqto eliminate extra tools.- Minimal process spawns in test flows reduces test time.
- Individual parallelism control for pipeline elements.
- Simpler and quick stress tests.
- Meaningful feature tests via shell pipelines.
- Composeability allows seamless feature tests with multiple apis.
- Eg: Generate test data | Create | Get | Update | Delete | Verify
tcli is designed to do feature testing including setup, test, validation and teardown
intuitively via a concise shell pipeline.
Imagine a standard CRUD api. tcli tests can be done as follows (ideally)
tcli testdata get -count 100 \
| tcli api create \
| tcli api get \
| tcli api update -body '{..update}' \
| tcli api delete \
| tcli api get -status_code 404
While the above example is possible, let us look at a real world scenario. We will use
petstore example from https://petstore.swagger.io/
petstore is a sample module included as it is familiar to developers as a swagger example.
Please see modules on how to manage modules.
Here is working test code that stays true to the above ideal scenario. Note how this approach reduces need for external tools to transform output from one command to fit input for the next command.
tcli utils echo -format 'range(1;2) | {body: {id:.,name:.|tostring,photourls:[.|tostring]}}' \
| tcli petstore pet addPet -format '{petId:.id}' \
| tcli petstore pet getPetById -format '{petId:.id,api_key:.id}' \
| tcli petstore pet deletePet -format '{petId:.message}' \
| tcli petstore pet getPetById -status_code 404
{"code":1,"type":"error","message":"Pet not found"}Look in the examples folder for all examples.
For a step by step explanation of how the above test works, See step by step explanation Refer how to build and run if you have trouble building.
If you are still interested, please go through docs to find ways to
combine tcli for meaningful tests.
To find even more sophisticated uses of tcli, see stress test with tcli
-
testing
-
-formatdoes not handle input beyond simple one level input like5,{"data":5}etc. If fully supported for multi-level json input, the-formatfeature can be much more versatile.
- How to build and run
- How to add a module
- Explanation of test code
- Examples
- Parsing openapi spec
- Formatting output