ash
ash

Reputation: 69

Response assertion for json response in jmeter for webservice

As i am new to webservice in jmeter ,I am not understand how to move ahead in this, I have a json response like below,How can i put assertion for the below...

{
  "flightDetails": [
    {
      "outBoundFlights": [
        {
          "flightInfo": {
            "departureCity": "Bengaluru, , IN - Kempegowda International Airport",
            "departureDateAndTime": "2017-04-24T17:00:00",
            "arrivalCity": "Newark, NJ, US - Newark Liberty Intl Arpt",
            "arrivalDateAndTime": "2017-04-25T07:55:00",
            "numberOfStops": 1,
            "individualPricing": [
              {
                "passengerType": 1,
                "totalTaxFeePerPaxType": 626.55,
                "totalTaxAmountPerPaxType": 461.55,
                "baseFareAmountPerPaxType": 165.0,
                "taxandFee": {
                  "markup": 6.6,
                  "merchantFee": 40.99,
                  "supplierTax": 410.96

Upvotes: 0

Views: 3384

Answers (2)

Dmitri T
Dmitri T

Reputation: 167992

You can use JSON Path Assertion available via JMeter Plugins project like:

  • Given you need to check whether departureCity equals "Bengaluru, , IN - Kempegowda International Airport
  • Add JSON Path Assertion as a child of the request returning your JSON response
  • Configure it as follows:

    JMeter JSON Path Assertion

  • If everything is fine the result will be successful

  • If expected value won't match the actual the sampler will be marked as failed:

    JSON Path Asertion Failure

JSON Path Assertion can be installed using JMeter Plugins Manager

Upvotes: 0

Poorvaja Deshmukh
Poorvaja Deshmukh

Reputation: 129

Just add response assertion in your HTTP request and add all JSON responce in Pattern to test field

enter image description here

Upvotes: 1

Related Questions