I'm getting assertion failure even if the response are correct. But it saying something about expected "/", Before and after the html code. Why is that?
Apply to: Main sample only
Response Field to Test: Text Response
Pattern Matching Rules: Contains
Patterns to test:
< html>
< body>
< h1>Flight request - 5< /h1>
< p>Departure airport code: GBG< /p>
< p>arrivalAirportCode: STM< /p>
< p>No of passengers: 12< /p>
< p>Status: CREATED< /p>
< /body>
< /html>
Response:
< html>
< body>
< h1>Flight request - 5< /h1>
< p>Departure airport code: GBG< /p>
< p>arrivalAirportCode: STM< /p>
< p>No of passengers: 12< /p>
< p>Status: CREATED< /p>
< /body>
< /html>
Assertion failure message: Test failed: text expected to contain /< html>
< body>
< h1>Flight request - 5< /h1>
< p>Departure airport code: GBG< /p>
< p>arrivalAirportCode: STM< /p>
< p>No of passengers: 12< /p>
< p>Status: CREATED< /p>
< /body>
< /html>/
I solved it by creating more "patterns to test" and to have only a single row in each "pattern to test." which it is compared. Probably it was a "invisible" whitespace or something else.
This is because JMeter internally uses a regular expression when you choose Contains or Matches pattern matching rules. Try to use the equals rule if possible, but be mindful of line breaks and white space characters that visually not be different but actually are.
More info: http://jmeter.apache.org/usermanual/component_reference.html#Response_Assertion
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With