Page 1 of 2
Webinject matching content
Posted: Wed Nov 21, 2018 5:29 pm
by lpereira
Hello all:
I have successfully configured a webinject page content, it can login to the url and te response is "WebInject OK - All tests passed successfully in seconds"
However i need to check if a expression exist, and send the alert accordingly if the expresion has been changed.
the plain text is
"Transaction capacity 30000/0"
and the code is
<tr><td class="nrow">Transaction capacity</td><td>30000/0</td><td></td></tr>
Can someone assist in order to get this configured?
this is the complete code i have
Code: Select all
<testcases repeat="1">
id="1"
description1="short description"
description2="long description"
method="post"
url="http:/XXX.XXX.XXX/csl/check"
postbody="username=XXXX&userpwd=XXXX"
verifypositive="verify this string exists"
verifynegative="verify this string does not exist"
logrequest="yes"
logresponse="yes"
sleep="3"
</testcases>
Re: Webinject matching content
Posted: Mon Nov 26, 2018 9:50 am
by scottwilkerson
Have you tried something like this?
Code: Select all
<testcases repeat="1">
id="1"
description1="short description"
description2="long description"
method="post"
url="http:/XXX.XXX.XXX/csl/check"
postbody="username=XXXX&userpwd=XXXX"
verifypositive='<tr><td class="nrow">Transaction capacity</td><td>30000/0</td><td></td></tr>'
verifynegative="verify this string does not exist"
logrequest="yes"
logresponse="yes"
sleep="3"
</testcases>
Re: Webinject matching content
Posted: Mon Nov 26, 2018 9:56 am
by lpereira
scottwilkerson wrote:Have you tried something like this?
Code: Select all
<testcases repeat="1">
id="1"
description1="short description"
description2="long description"
method="post"
url="http:/XXX.XXX.XXX/csl/check"
postbody="username=XXXX&userpwd=XXXX"
verifypositive='<tr><td class="nrow">Transaction capacity</td><td>30000/0</td><td></td></tr>'
verifynegative="verify this string does not exist"
logrequest="yes"
logresponse="yes"
sleep="3"
</testcases>
yes and i have modified the verify positive check (30000/0 to 30000/5) in order to force an alert, but still in green.
Re: Webinject matching content
Posted: Mon Nov 26, 2018 12:30 pm
by scottwilkerson
Actually, the code there shouldn't have both a positive and negative
How about something like this
Code: Select all
<testcases repeat="1">
id="1"
description1="short description"
description2="long description"
method="post"
url="http:/XXX.XXX.XXX/csl/check"
postbody="username=XXXX&userpwd=XXXX"
verifypositive="30000/0"
logrequest="yes"
logresponse="yes"
sleep="3"
</testcases>
Re: Webinject matching content
Posted: Mon Nov 26, 2018 1:30 pm
by lpereira
scottwilkerson wrote:Actually, the code there shouldn't have noth a positive and negative
How about something like this
Code: Select all
<testcases repeat="1">
id="1"
description1="short description"
description2="long description"
method="post"
url="http:/XXX.XXX.XXX/csl/check"
postbody="username=XXXX&userpwd=XXXX"
verifypositive="30000/0"
logrequest="yes"
logresponse="yes"
sleep="3"
</testcases>
made the changes, forced the alert but nothing hass been changed
Code: Select all
<testcases repeat="1">
id="1"
description1="short description"
description2="long description"
method="post"
url="http://XXX.XXX.XXX/XXX/XXX"
postbody="username=XXX&userpwd=XXX"
verifypositive="30000/0"
logrequest="yes"
logresponse="yes"
sleep="3"
</testcases>
Re: Webinject matching content
Posted: Mon Nov 26, 2018 1:38 pm
by scottwilkerson
Looking at our example case in the wizard I see this:
Code: Select all
<testcases repeat="1">
<testvar varname="LOGIN_URL">http://myserver/login.php</testvar>
<testvar varname="LOGIN1">bob</testvar>
<testvar varname="PASSWD1">sponge</testvar>
<testvar varname="SUCCESSFULL_TEST_TEXT">Welcome Bob</testvar>
<case
id="1"
description1="login test case"
description2="verify string login"
method="post"
url="${LOGIN_URL}"
postbody="login=${LOGIN1}&passwd=${PASSWD1}"
verifypositive="${SUCCESSFULL_TEST_TEXT}"
/>
</testcases>
It is like you are actually missing the inner
<case
Can we try the following
Code: Select all
<testcases repeat="1">
<testvar varname="LOGIN_URL">http:/XXX.XXX.XXX/csl/check</testvar>
<testvar varname="LOGIN1">XXXX</testvar>
<testvar varname="PASSWD1">XXXX</testvar>
<testvar varname="SUCCESSFULL_TEST_TEXT">30000/0</testvar>
<case
id="1"
description1="login test case"
description2="verify string login"
method="post"
url="${LOGIN_URL}"
postbody="login=${LOGIN1}&passwd=${PASSWD1}"
verifypositive="${SUCCESSFULL_TEST_TEXT}"
/>
</testcases>
Re: Webinject matching content
Posted: Mon Nov 26, 2018 1:51 pm
by lpereira
scottwilkerson wrote:Looking at our example case in the wizard I see this:
Code: Select all
<testcases repeat="1">
<testvar varname="LOGIN_URL">http://myserver/login.php</testvar>
<testvar varname="LOGIN1">bob</testvar>
<testvar varname="PASSWD1">sponge</testvar>
<testvar varname="SUCCESSFULL_TEST_TEXT">Welcome Bob</testvar>
<case
id="1"
description1="login test case"
description2="verify string login"
method="post"
url="${LOGIN_URL}"
postbody="login=${LOGIN1}&passwd=${PASSWD1}"
verifypositive="${SUCCESSFULL_TEST_TEXT}"
/>
</testcases>
It is like you are actually missing the inner
<case
Can we try the following
Code: Select all
<testcases repeat="1">
<testvar varname="LOGIN_URL">http:/XXX.XXX.XXX/csl/check</testvar>
<testvar varname="LOGIN1">XXXX</testvar>
<testvar varname="PASSWD1">XXXX</testvar>
<testvar varname="SUCCESSFULL_TEST_TEXT">30000/0</testvar>
<case
id="1"
description1="login test case"
description2="verify string login"
method="post"
url="${LOGIN_URL}"
postbody="login=${LOGIN1}&passwd=${PASSWD1}"
verifypositive="${SUCCESSFULL_TEST_TEXT}"
/>
</testcases>
i modified it as requested, now i have an error msj
Code: Select all
(Return code of 25 for service 'CRONOS' on host 'CRONOS' was out of bounds)
No close element tag [Ln: 14, Col: 57]
Re: Webinject matching content
Posted: Mon Nov 26, 2018 4:26 pm
by scottwilkerson
Can you PM me the whole file, I just tested the above example and didn't get an error.
It could be possible that the login or password contains special chars not valid in XML and we may need to work around that.
Re: Webinject matching content
Posted: Tue Nov 27, 2018 6:01 am
by lpereira
scottwilkerson wrote:Can you PM me the whole file, I just tested the above example and didn't get an error.
It could be possible that the login or password contains special chars not valid in XML and we may need to work around that.
Thanks i have sent you the file.
regards
Re: Webinject matching content
Posted: Tue Nov 27, 2018 8:54 am
by scottwilkerson
Your PM stated the new error was
lpereira wrote:Code: Select all
"WebInject CRITICAL - Test case number 1 failed"
This is different than the error you posted in the thread
Code: Select all
(Return code of 25 for service 'CRONOS' on host 'CRONOS' was out of bounds)
No close element tag [Ln: 14, Col: 57]
Are you 100% sure there are no other fields required to be posted? this could cause it to not authenticate properly.