You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by yaroslav1 <sl...@yahoo.com> on 2008/12/31 23:13:33 UTC
how to "assert" a whole html page with some dynamic content
Hi,
First for all - Happy New Year everyboby!
Here is a problem which I cannot solve a few days... :(
I'm trying to check a whole html page with some dynamic content.
My approach is like:
1) make http-request;
2) by using regular-expression-extractor to create those variables (related
to the dynamic content);
3) usu response-assertion (with selected "Text Response" and "Equal"), into
"patterns to test" - copy-paste the full page from a response of the step
1), and to replace the dynamic content by variables from
regular-expression-extractors.
But this is does not work as expected.
I do understand that you shoul not to "debug" my test-plan, but this is the
best way to provide details.
Here is my simple test-plan (I've also attached as a file) - what is wrong?
-------------
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.1">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test
Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables"
elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments"
testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup"
testname="Thread Group" enabled="true">
<elementProp name="ThreadGroup.main_controller"
elementType="LoopController" guiclass="LoopControlPanel"
testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<longProp name="ThreadGroup.start_time">1228863671000</longProp>
<longProp name="ThreadGroup.end_time">1228863671000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<CookieManager guiclass="CookiePanel" testclass="CookieManager"
testname="HTTP Cookie Manager" enabled="true">
<collectionProp name="CookieManager.cookies"/>
<boolProp name="CookieManager.clearEachIteration">true</boolProp>
<stringProp name="CookieManager.policy">rfc2109</stringProp>
</CookieManager>
<hashTree/>
<ConfigTestElement guiclass="HttpDefaultsGui"
testclass="ConfigTestElement" testname="HTTP Request Defaults"
enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments"
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined
Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp
name="HTTPSampler.domain">gonew.warrantysupport.net</stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path"></stringProp>
</ConfigTestElement>
<hashTree/>
<ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer"
testname="Constant Timer" enabled="true">
<stringProp name="ConstantTimer.delay">1000</stringProp>
</ConstantTimer>
<hashTree/>
<HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler"
testname="HTTP - root page" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments"
guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined
Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">/</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">false</boolProp>
<boolProp name="HTTPSampler.auto_redirects">true</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<stringProp name="HTTPSampler.FILE_NAME"></stringProp>
<stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
<stringProp name="HTTPSampler.mimetype"></stringProp>
<stringProp name="HTTPSampler.monitor">false</stringProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
</HTTPSampler>
<hashTree>
<RegexExtractor guiclass="RegexExtractorGui"
testclass="RegexExtractor" testname="Regular Expression Extractor"
enabled="true">
<stringProp name="RegexExtractor.useHeaders">false</stringProp>
<stringProp name="RegexExtractor.refname">ACTION</stringProp>
<stringProp name="RegexExtractor.regex"><form
id="LoginForm" name="LoginForm" method="post"
action="login.aspx\?__ufps=(.+?)&AspxAutoDetectCookieSupport=1"></stringProp>
<stringProp name="RegexExtractor.template">$1$</stringProp>
<stringProp name="RegexExtractor.default">bad</stringProp>
<stringProp name="RegexExtractor.match_number">1</stringProp>
</RegexExtractor>
<hashTree/>
<RegexExtractor guiclass="RegexExtractorGui"
testclass="RegexExtractor" testname="Regular Expression Extractor"
enabled="true">
<stringProp name="RegexExtractor.useHeaders">false</stringProp>
<stringProp name="RegexExtractor.refname">VIEWSTATE</stringProp>
<stringProp name="RegexExtractor.regex"><input
type="hidden" name="__VIEWSTATE"
value="(.+?)"></stringProp>
<stringProp name="RegexExtractor.template">$1$</stringProp>
<stringProp name="RegexExtractor.default">bad</stringProp>
<stringProp name="RegexExtractor.match_number">1</stringProp>
</RegexExtractor>
<hashTree/>
<RegexExtractor guiclass="RegexExtractorGui"
testclass="RegexExtractor" testname="Regular Expression Extractor"
enabled="true">
<stringProp name="RegexExtractor.useHeaders">false</stringProp>
<stringProp name="RegexExtractor.refname">LINK</stringProp>
<stringProp name="RegexExtractor.regex"> - <a
href="login.aspx\?__VIEWSTATE=(.+?)&</stringProp>
<stringProp name="RegexExtractor.template">$1$</stringProp>
<stringProp name="RegexExtractor.default">bad</stringProp>
<stringProp name="RegexExtractor.match_number">1</stringProp>
</RegexExtractor>
<hashTree/>
<ResponseAssertion guiclass="AssertionGui"
testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
<collectionProp name="Asserion.test_strings">
<stringProp name="-1509407321"><!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html>
<head>
<title>goNEW</title>
</head>
<body>
${ACTION_g0}
${VIEWSTATE_g0}
<div align="Center"><img
src="/(X(1))/Images/goNEW.gif" alt="NEW"
border="0" /></div>
Email Address:<br>
<input name="tbEmailAddress" size="8"/>
@<select
name="loginValidEmailGroup$ctl00$drpEmails"
id="loginValidEmailGroup_ctl00_drpEmails">
<option value="newcorp.com">newcorp.com</option>
<option
value="servicebench.com">servicebench.com</option>
<option value="waca.com">waca.com</option>
</select><span
id="loginValidEmailGroup_ctl00_lblBr"><br/></span>
Password:<br>
<input name="tbPassword"
type="password"/><br>
<input name="btnSignIn" type="submit"
value="Sign In"/><br>
<br>
${LINK_g0}__ET=ctl04&__EA=registerForm&__ufps=&AspxAutoDetectCookieSupport=1">I
need to register </a><br>
${LINK_g0}__ET=ctl06&__EA=passwordForm&__ufps=&AspxAutoDetectCookieSupport=1">I
forgot my password </a><br>
${LINK_g0}__ET=ctl08&__EA=feedbackAboutForm&__ufps=&AspxAutoDetectCookieSupport=1">Feedback
&amp; about
</a></form></body></html></stringProp>
</collectionProp>
<stringProp
name="Assertion.test_field">Assertion.response_data</stringProp>
<stringProp name="Assertion.assume_success">false</stringProp>
<intProp name="Assertion.test_type">8</intProp>
</ResponseAssertion>
<hashTree/>
</hashTree>
<ResultCollector guiclass="ViewResultsFullVisualizer"
testclass="ResultCollector" testname="View Results Tree" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>true</xml>
<fieldNames>false</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler"
testname="Debug Sampler" enabled="true">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>
<hashTree/>
<ResultCollector guiclass="AssertionVisualizer"
testclass="ResultCollector" testname="Assertion Results" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>true</xml>
<fieldNames>false</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
---------------------
http://www.nabble.com/file/p21237485/test.jmx test.jmx
--
View this message in context: http://www.nabble.com/how-to-%22assert%22-a-whole-html-page-with-some-dynamic-content-tp21237485p21237485.html
Sent from the JMeter - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: how to "assert" a whole html page with some dynamic content
Posted by sebb <se...@gmail.com>.
On 31/12/2008, yaroslav1 <sl...@yahoo.com> wrote:
>
> Hi,
>
> First for all - Happy New Year everyboby!
>
> Here is a problem which I cannot solve a few days... :(
>
> I'm trying to check a whole html page with some dynamic content.
That is going to be tricky and expensive - is it really necessary to
check everything?
I suggest you just check a few important parts of the page in the test itself.
If you really want to check the full page, use the Save Responses to a
File element to create a file with the full details and compare that
separately after the test has finished.
> My approach is like:
> 1) make http-request;
> 2) by using regular-expression-extractor to create those variables (related
> to the dynamic content);
> 3) usu response-assertion (with selected "Text Response" and "Equal"), into
> "patterns to test" - copy-paste the full page from a response of the step
> 1), and to replace the dynamic content by variables from
> regular-expression-extractors.
> But this is does not work as expected.
Probably because of line endings.
If you really want to debug this, then save the HTML to a file, and
create a test plan using an HTTP sampler with the "file" protocol.
You can then re-run the test as often as you want, and gradually
refine the RE to do what you want.
Start with a short section using "Contains" and gradually add more to
the RE. Switch to "Equal" at the very end.
> I do understand that you shoul not to "debug" my test-plan, but this is the
> best way to provide details
> Here is my simple test-plan (I've also attached as a file) - what is wrong?
Please don't send attachments or large includes to the list.
<snip/>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org