Testing a microservice

Creating a test using a file

  1. Create a semi-colon(;)-delimited file that contains input json, expected output json and maximum response time in milliseconds. An example is provided below
input_json;output_json;max_response_time
{"a": 3, "b": 4};{"sum": 7};200
{"a": -1, "b": 2};{"sum": 1};200
{"a": 0, "b": 0};{"sum": 3};200
{"a": 3, "b": 4};{"sum": 7};1
  1. Click “View Tests” in a runnable’s detail page
_images/create_test_2.png
  1. Click “Create Test” button
_images/create_test_3.png
  1. Click “Create” button
  2. Enter title, choose the test file we just created and click “Create”
_images/create_test_5.png
  1. Click title of the new test. This will direct you to the test’s detail page
_images/create_test_6.png
  1. Make sure all test cases are listed in “Scenarios”
_images/create_test_7.png

Adding a scenario manually

  1. In detail page of test, click “View Scenarios”
_images/add_scenario_1.png
  1. Click “Add Scenario”
_images/add_scenario_2.png
  1. Enter input json, expected json and maximum response time. Click “Add Scenario.” If there is an already existing scenario with the same input and expected json, only the one with the less maximum response time will remain.
_images/add_scenario_3.png

Adding scenarios using a file

  1. Prepare a file similar to what we created in creating a test
  2. In a test’s detail page, click “Add Scenarios using File”
  3. Choose the file and click “Add Scenarios using File.” If there is an already existing scenario with the same input and expected json, only the one with the less maximum response time will remain.

Deleting a scenario

  1. In a test’s detail page, click the name of a scenario in “Scenarios”
  2. Click “Delete.” Note that this will delete all records of this scenario running on runnables and runnable versions.

Deleting a test

  1. In a test’s detail page, click “Delete.” Note that this will delete all records of this test running on runnables and runnable versions.

Running a test on a runnable

  1. To run test, go to detail page of test. Click “Test Runnable”
_images/run_test_1.png
  1. Choose a test that you want to run for this runnable. Then click “Test Runnable”
_images/run_test_2.png
  1. This will direct you to a list of test results on the runnable. Wait until your test request is complete
_images/run_test_3.png
  1. Click the name of the test result to check the test result. You can see what scenarios passed and failed and why they failed
_images/run_test_4.png