validation - JMeter: What is the Best Assertion Type to Validate a Single Node Value in an XML? -


i've been reading lot of discussion , posts on assertions, including:

i still unclear efficient way validate particular node value xml response.

i have http request sampler pass in json payload ms sql server database database performs calculation , returns xml response.

the thing want validate <calculationsuccessfulindicator>true</calculationsuccessfulindicator>

it's pretty binary test. it's either true (pass) or false (fail). , have positive test data , negative test data ensure fails when should , passes when should. (no need validate xsd or other part of xml)

to me, xpath assertion seemed accurate way achieve this. set apply main sample , sub-samples , defined xpath assertion /response/pricingunit/primaryallocation/pricingterm/calculationsuccessfulindicator how specify node value of "true"?

next, tried response assertion set check thing want validate <calculationsuccessfulindicator>true</calculationsuccessfulindicator>. problem was, when actual value "false", assertion still passed.

i continued on trying performing regex on response , passed compare assertion; passed, on negative test.

anyone have thoughts on efficient , best way implement it?

it looks didn't read referenced articles either @ or attentive enough, first link states:

to give idea how should work, here few assertions on example.com domain:

//title/text()='example domain'- checks tag text “example domain” - pass

assuming above statement need following xpath expression in xpath assertion:

/response/pricingunit/primaryallocation/pricingterm/calculationsuccessfulindicator/text()='true' 

i not guarantee work until see full xml response, should give idea regarding how proceed.

by way, possible test xpath expressions against live response right in view results tree listener using "xpath tester" mode. here example demonstrating above xpath query works fine:

xpath tester

see how debug apache jmeter script article more details on getting bottom of jmeter test problem.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -