Question

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>/

Was it helpful?

Solution

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.

OTHER TIPS

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

Its because in actual your script is not running, look in to Listener "Response in tree " in HTML view and you will find that scripts are not running and pages are not navigating in actual, though response are getting displayed as passed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top