| <!DOCTYPE html SYSTEM "about:legacy-compat"> |
| <html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-15"><title>Apache JMeter |
| - |
| User's Manual: Building an Advanced Web Test Plan</title><meta name="viewport" content="width=device-width, initial-scale=1"><link href="http://fonts.googleapis.com/css?family=Merriweather:400normal" rel="stylesheet" type="text/css"><link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet" type="text/css"><link rel="stylesheet" type="text/css" href="../css/new-style.css"><link rel="apple-touch-icon-precomposed" href="../images/apple-touch-icon.png"><link rel="icon" href="../images/favicon.png"><meta name="msapplication-TileColor" content="#ffffff"><meta name="msapplication-TileImage" content="../images/mstile-144x144.png"><meta name="theme-color" content="#ffffff"></head><body role="document"><a href="#content" class="hidden">Main content</a><div class="header"><!-- |
| APACHE LOGO |
| --><div><a href="http://www.apache.org"><img title="Apache Software Foundation" class="asf-logo logo" src="../images/asf-logo.svg" alt="Logo ASF"></a></div><!-- |
| PROJECT LOGO |
| --><div><a href="http://jmeter.apache.org/"><img class="logo" src="../images/logo.svg" alt="Apache JMeter"></a></div><div class="banner"><iframe src="http://www.apache.org/ads/bannerbar.html" style="border-width:0;" frameborder="0" scrolling="no"></iframe><div class="clear"></div></div></div><div class="nav"><ul class="menu"><li onClick="return true"><div class="menu-title">About</div><ul><li><a href="../index.html">Overview</a></li><li><a href="http://www.apache.org/licenses/">License</a></li></ul></li></ul><ul class="menu"><li onClick="return true"><div class="menu-title">Download</div><ul><li><a href="../download_jmeter.cgi">Download Releases</a></li><li><a href="../changes.html">Release Notes</a></li></ul></li></ul><ul class="menu"><li onClick="return true"><div class="menu-title">Documentation</div><ul><li><a href="../usermanual/get-started.html">Get Started</a></li><li><a href="../usermanual/index.html">User Manual</a></li><li><a href="../usermanual/best-practices.html">Best Practices</a></li><li><a href="../usermanual/component_reference.html">Component Reference</a></li><li><a href="../usermanual/functions.html">Functions Reference</a></li><li><a href="../changes_history.html">Change History</a></li><li><a href="../api/index.html">Javadocs</a></li><li><a href="../building.html">Building JMeter and Add-Ons</a></li><li><a href="http://wiki.apache.org/jmeter">JMeter Wiki</a></li><li><a href="http://wiki.apache.org/jmeter/JMeterFAQ">FAQ (Wiki)</a></li></ul></li></ul><ul class="menu"><li onClick="return true"><div class="menu-title">Tutorials (PDF format)</div><ul><li><a href="../usermanual/jmeter_distributed_testing_step_by_step.pdf">Distributed Testing</a></li><li><a href="../usermanual/jmeter_proxy_step_by_step.pdf">Recording Tests</a></li><li><a href="../usermanual/junitsampler_tutorial.pdf">JUnit Sampler</a></li><li><a href="../usermanual/jmeter_accesslog_sampler_step_by_step.pdf">Access Log Sampler</a></li><li><a href="../extending/jmeter_tutorial.pdf">Extending JMeter</a></li></ul></li></ul><ul class="menu"><li onClick="return true"><div class="menu-title">Community</div><ul><li><a href="../issues.html">Issue Tracking</a></li><li><a href="../mail.html">Mailing Lists</a></li><li><a href="../svnindex.html">Source Repositories</a></li><li><a href="../building.html">Building and Contributing</a></li><li><a href="https://projects.apache.org/project.html?jmeter">Project info at Apache</a></li><li><a href="http://wiki.apache.org/jmeter/JMeterCommitters">Contributors</a></li></ul></li></ul><ul class="menu"><li onClick="return true"><div class="menu-title">Foundation</div><ul><li><a href="http://www.apache.org/">ASF</a></li><li><a href="http://www.apache.org/foundation/getinvolved.html">Get Involved in the ASF</a></li><li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></li></ul></div><div class="main" id="content"><div class="social-media"><ul class="social-media-links"><li class="twitter"><a href="https://twitter.com/ApacheJMeter" title="Follow us on Twitter"><i class="fa fa-twitter" aria-hidden="true"></i>Twitter</a></li><li class="github"><a href="https://github.com/apache/jmeter" title="Fork us on github"><i class="fa fa-github" aria-hidden="true"></i>github</a></li></ul></div><ul class="pagelinks"><li><a href="build-web-test-plan.html">< Prev</a></li><li><a href="../index.html">Index</a></li><li><a href="build-db-test-plan.html">Next ></a></li></ul><div class="section"><h1 id="building">6. Building an Advanced Web Test Plan<a class="sectionlink" href="#building" title="Link to here">¶</a></h1> |
| <p>In this section, you will learn how to create advanced |
| <a href="build-test-plan.html">Test Plans</a> to test a Web site.</p> |
| |
| <p>For an example of a basic Test Plan, see |
| <a href="build-web-test-plan.html">Building a Web Test Plan</a>.</p></div><div class="section"><h1 id="session_url_rewriting">6.1 Handling User Sessions With URL Rewriting<a class="sectionlink" href="#session_url_rewriting" title="Link to here">¶</a></h1> |
| <p>If your web application uses URL rewriting rather than cookies to save session information, |
| then you'll need to do a bit of extra work to test your site.</p> |
| <p>To respond correctly to URL rewriting, JMeter needs to parse the HTML |
| received from the server and retrieve the unique session ID. Use the appropriate <a href="../usermanual/component_reference.html#HTTP_URL_Re-writing_Modifier">HTTP URL Re-writing Modifier</a> |
| to accomplish this. Simply enter the name of your session ID parameter into the modifier, and it |
| will find it and add it to each request. If the request already has a value, it will be replaced. |
| If "Cache Session Id?" is checked, then the last found session id will be saved, |
| and will be used if the previous HTTP sample does not contain a session id. |
| </p> |
| |
| <div class="example"><div class="title">URL Rewriting Example<a class="sectionlink" href="#url_rewriting_example" title="Link to here">¶</a></div> |
| <p>Download <a href="../demos/URLRewritingExample.jmx">this example</a>. In Figure 1 is shown a |
| test plan using URL rewriting. Note that the URL Re-writing modifier is added to the SimpleController, |
| thus assuring that it will only affect requests under that SimpleController.</p> |
| <figure><a href="../images/screenshots/url_rewrite_example_a.png"><img src="../images/screenshots/url_rewrite_example_a.png" width="" height="" alt="Figure 1 - Test Tree"></a><figcaption>Figure 1 - Test Tree</figcaption></figure> |
| <p>In Figure 2, we see the URL Re-writing modifier GUI, which just has a field for the user to specify |
| the name of the session ID parameter. There is also a checkbox for indicating that the session ID should |
| be part of the path (separated by a ";"), rather than a request parameter</p> |
| <figure><a href="../images/screenshots/url_rewrite_example_b.png"><img src="../images/screenshots/url_rewrite_example_b.png" width="" height="" alt="Figure 2 - Request parameters"></a><figcaption>Figure 2 - Request parameters</figcaption></figure> |
| </div> |
| </div><div class="section"><h1 id="header_manager">6.2 Using a Header Manager<a class="sectionlink" href="#header_manager" title="Link to here">¶</a></h1> |
| <p>The <a href="../usermanual/component_reference.html#HTTP_Header_Manager">HTTP Header Manager</a> lets you customize what information |
| JMeter sends in the HTTP request header. This header includes properties like "User-Agent", |
| "Pragma", "Referer", etc.</p> |
| <p>The <a href="../usermanual/component_reference.html#HTTP_Header_Manager">HTTP Header Manager</a>, like the <a href="../usermanual/component_reference.html#HTTP_Cookie_Manager">HTTP Cookie Manager</a>, |
| should probably be added at the Thread Group level, unless for some reason you wish to |
| specify different headers for the different <a href="../usermanual/component_reference.html#HTTP_Request">HTTP Request</a> objects in |
| your test.</p> |
| |
| </div><ul class="pagelinks"><li><a href="build-web-test-plan.html">< Prev</a></li><li><a href="../index.html">Index</a></li><li><a href="build-db-test-plan.html">Next ></a></li></ul><div class="share-links"> |
| Share this page: |
| <ul><li class="fb"><a data-social-url="https://facebook.com/sharer/sharer.php?u=" title="Share on facebook"><i class="fa fa-facebook" aria-hidden="true"></i>share</a></li><li class="twitter"><a data-social-url="https://twitter.com/intent/tweet?url=" title="Tweet on twitter"><i class="fa fa-twitter" aria-hidden="true"></i>tweet</a></li><li class="gplus"><a data-social-url="https://plus.google.com/share?url=" title="Share on Google+"><i class="fa fa-google-plus" aria-hidden="true"></i>share</a></li></ul></div></div><div class="footer"><div class="copyright"> |
| Copyright © |
| 1999 – |
| 2016 |
| , Apache Software Foundation |
| </div><div class="trademarks">Apache, Apache JMeter, JMeter, the Apache |
| feather, and the Apache JMeter logo are |
| trademarks of the |
| Apache Software Foundation. |
| </div></div><script>(function(){ |
| // fill in the current location into social links on this page. |
| "use strict"; |
| var as = document.getElementsByTagName('a'); |
| var loc = document.location.href; |
| if (!loc.toLowerCase().startsWith('http')) { |
| return; |
| } |
| for (var i=0; i<as.length; i++) { |
| var href = as[i].getAttribute('data-social-url'); |
| if (href !== null) { |
| as[i].href = href + encodeURIComponent(loc); |
| } |
| } |
| })();</script></body></html> |