# Testing the flow

# Using postman or any REST client

You can test the WeatherRiskReporting API flow using any REST client of your choice. For this tutorial we are using Postman.

Open the postman and provide the following.

Postman configuration

Method: GET

URL: http://localhost:1880/weather/report?location=110001,in

Note

Port 1880 is constant when testing locally.

OR

# Using the designer test tab

Kumologica integrated testing features makes testing flows very easy without stepping out of the editor. Now, we will setup the testing configuration for the WeatherRiskReporting API.

  1. Switch to the "TEST" tab.

TIP

There will be a default test case flow showing up on the Test tab. For this exercise let's delete that test case flow and we will build it from scratch.

  1. Drag a "HTTPTestCase" node onto the canvas. This node is used for injecting a test message to a flow having EventListener source set as APIGateway.

  2. Configure the HTTPTestCase node as noted below. Leave rest of the configuration as default.

Display Name : GET:/weather/report

Method : GET

Path :  /weather/report?location=110001,in
1
2
3
4
5

TIP

For this test case, we are passing the location query parameter as 110001,in .

  1. Add an Assertion node and wire it to the HTTPTestCase node added in the previous step. Open the assertion node and provide the following configuration.

    Display Name : check response
    Selector : Status Code
    Comparison :  Equals
    Value : 200
    
    1
    2
    3
    4
  2. Drag a "TestCaseEnd" node onto the canvas and wire it to the assertion node added in the previous step.

  3. Switch to the "TEST" tab in the right side panel, select the test case from the drop down and execute the test case and observe the results.

You should be seeing the following as the response

{
   "Weather" : "Its Misty",
   "Advice" : "Drive carefully. Check your wiper"
}
1
2
3
4