{"id":256,"date":"2015-03-23T18:21:04","date_gmt":"2015-03-23T16:21:04","guid":{"rendered":"http:\/\/le-moulin-de-verre.com\/fieldnotes\/?p=256"},"modified":"2015-03-24T10:19:27","modified_gmt":"2015-03-24T08:19:27","slug":"jsf-jmeter-siteminder","status":"publish","type":"post","link":"https:\/\/le-moulin-de-verre.com\/fieldnotes\/?p=256","title":{"rendered":"JSF JMeter SiteMinder"},"content":{"rendered":"<p>Quick notes on how to configure a JMeter test scenario for a JSF application protected by SiteMinder.<\/p>\n<p>\u00a0<\/p>\n<p>For this example, we consider that the URL of our application is\u00a0<a href=\"http:\/\/servername.corp\/AppContext\">http:\/\/serverName.corp\/AppContext<\/a><\/p>\n<p>\u00a0<\/p>\n<h1>General setup<\/h1>\n<p>\u00a0<\/p>\n<p>Under thread group use HTTP request default :<\/p>\n<p>\u00a0<\/p>\n<ul>\n<li>server name: servername.corp<\/p>\n<\/li>\n<li>\n<p>path: \/AppContext\/<\/p>\n<\/li>\n<li>\n<p>and very important tick follow redirect !!<\/p>\n<\/li>\n<\/ul>\n<p>\u00a0<\/p>\n<h1>Authenticate against SiteMinder<\/h1>\n<p>\u00a0<\/p>\n<p>We need the thread group to record SiteMinder related authentication and submit it with each request.<\/p>\n<p>\u00a0<\/p>\n<h2>Add an HTTP Header manager<\/h2>\n<ul>\n<li>all set to default<\/li>\n<\/ul>\n<p>\u00a0<\/p>\n<h2>Add an HTTP cookie manager<\/h2>\n<ul>\n<li>policy: default<\/p>\n<\/li>\n<li>\n<p>implementation: HC4CookieHandler. This is important, the default does not work.<\/p>\n<\/li>\n<\/ul>\n<p>\u00a0<\/p>\n<h2>Add an HTTP Authorization manager<\/h2>\n<ul>\n<li>clear on each iteration: yes<\/p>\n<\/li>\n<li>\n<p>Base URL:\u00a0<a href=\"http:\/\/servername.corp\/AppContext\">http:\/\/serverName.corp\/AppContext<\/a><\/p>\n<\/li>\n<li>\n<p>user name: YouUserName<\/p>\n<\/li>\n<li>\n<p>Password: YourPassword<\/p>\n<\/li>\n<li>\n<p>Domain: YourWindowsDomain<\/p>\n<\/li>\n<\/ul>\n<p>\u00a0<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<h2>Add a basic HTTP request to application root<\/h2>\n<p>This request allows to authenticate to SiteMinder prior to running the scenario. Nothing to configure in this request because root is the default target of our thread group.<\/p>\n<p>\u00a0<\/p>\n<p>Tick the option <em>follow redirect<\/em> in this first request.<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<h1>Extract and re-inject JSF session-related content<\/h1>\n<p>\u00a0<\/p>\n<p>By default, when recording the scenario, the values of JSF session are hardcoded in the script.<\/p>\n<p>This will lead to errors in subsequent run because the Session ID and related session may have expired.<\/p>\n<p>\u00a0<\/p>\n<p>We need to add an extractor to get the JSF session data out of server response and re-inject it in the following requests as a browser would do.<\/p>\n<p>\u00a0<\/p>\n<p><em>If you forget this step, you are likely to encounter an error like &#8220;cannot restore view&#8221;<\/em><\/p>\n<p>\u00a0<\/p>\n<h2>Extract view state using an expression extractor<\/h2>\n<p>\u00a0<\/p>\n<p>Under first recorded request, add a JSF Regular Expression Extractor<\/p>\n<ul>\n<li>Reference name (i.e. the name of the variable where state will be stored): <code>jsfViewState<\/code><\/p>\n<\/li>\n<li>\n<p>Regular expression: <code>&lt;input type=\"hidden\" name=\"javax.faces.ViewState\" id=\"javax.faces.ViewState\" value=\"(.+?)\" autocomplete=\"off\" \/&gt;<\/code><\/p>\n<\/li>\n<li>\n<p>template: <code>$1$<\/code><\/p>\n<\/li>\n<li>\n<p>default value (will be used if value cannot be extracted): <code>wrong_value_easily_identifiable<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u00a0<\/p>\n<h2>Substitute value in subsequent requests<\/h2>\n<p>\u00a0<\/p>\n<p>Modify subsequent request to replace recorded (hardcoded) value of <code>javax.faces.ViewState<\/code> by <code>${jsfViewState}<\/code><\/p>\n<p>\u00a0<\/p>\n<h1>Save full workbench<\/h1>\n<p>When using workbench, tick save workbench to embed it to the saved file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Quick notes on how to configure a JMeter test scenario for a JSF application protected by SiteMinder. \u00a0 For this example, we consider that the URL of our application is\u00a0http:\/\/serverName.corp\/AppContext \u00a0 General setup \u00a0 Under thread group use HTTP request default : \u00a0 server name: servername.corp path: \/AppContext\/ and very important tick follow redirect !! &hellip; <a href=\"https:\/\/le-moulin-de-verre.com\/fieldnotes\/?p=256\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;JSF JMeter SiteMinder&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[1],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5WcEf-48","_links":{"self":[{"href":"https:\/\/le-moulin-de-verre.com\/fieldnotes\/index.php?rest_route=\/wp\/v2\/posts\/256"}],"collection":[{"href":"https:\/\/le-moulin-de-verre.com\/fieldnotes\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/le-moulin-de-verre.com\/fieldnotes\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/le-moulin-de-verre.com\/fieldnotes\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/le-moulin-de-verre.com\/fieldnotes\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=256"}],"version-history":[{"count":3,"href":"https:\/\/le-moulin-de-verre.com\/fieldnotes\/index.php?rest_route=\/wp\/v2\/posts\/256\/revisions"}],"predecessor-version":[{"id":259,"href":"https:\/\/le-moulin-de-verre.com\/fieldnotes\/index.php?rest_route=\/wp\/v2\/posts\/256\/revisions\/259"}],"wp:attachment":[{"href":"https:\/\/le-moulin-de-verre.com\/fieldnotes\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=256"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/le-moulin-de-verre.com\/fieldnotes\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=256"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/le-moulin-de-verre.com\/fieldnotes\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}