<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Altentee » Performance &#38; Test Automation Experts &#187; loadrunner</title>
	<atom:link href="http://altentee.com/blogs/tag/loadrunner/feed/" rel="self" type="application/rss+xml" />
	<link>http://altentee.com</link>
	<description>Performance and Test Automation Experts</description>
	<lastBuildDate>Fri, 04 Nov 2011 03:17:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>A year in review and a consolidated approach</title>
		<link>http://altentee.com/blogs/2010/a-year-in-review-and-a-consolidated-approach/</link>
		<comments>http://altentee.com/blogs/2010/a-year-in-review-and-a-consolidated-approach/#comments</comments>
		<pubDate>Thu, 30 Dec 2010 21:53:02 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[jmeter]]></category>
		<category><![CDATA[loadrunner]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[watir]]></category>

		<guid isPermaLink="false">http://altentee.com/blogs/?p=1144</guid>
		<description><![CDATA[Wow, wasn&#8217;t that long ago when I was promising things that were harder, better, faster and stronger. I think I got part of the way there. The core reason I set up Altentee was to provide reliable (and potentially cheaper) alternatives to traditional licensed performance testing tool sets. There&#8217;s no doubt Altentee can test at [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, wasn&#8217;t that long ago when I was promising things that were <a href="http://altentee.com/blogs/blogs/2010/harder-better-faster-stronger-and-cheaper/">harder, better, faster and stronger</a>. I think I got part of the way there. The core reason I set up Altentee was to provide reliable (and potentially cheaper) alternatives to traditional licensed performance testing tool sets. There&#8217;s no doubt Altentee can test at the limits of your typical web app using tools that cost zilch. The bigger challenge I&#8217;ve found this year is convincing potential clients that they really don&#8217;t need to spend that much. I&#8217;ve even offered a <a href="http://altentee.com">free load test on our homepage</a> to help illustrate this point.</p>
<p>We were lucky to be selected by the development team at <a href="http://www.cordelta.com/">Cordelta</a> to help them automate and performance test a high profile public website called <a href="http://www.myhospitals.gov.au/">MyHospitals</a>. We were able to test millions of hits per hour from domestic and international locations in a wide variety of load scenarios. The success of this approach was underpinned by the following:</p>
<ol>
<li>An open minded project / development team not coupled to a &#8216;must-have-most-expensive-toolset-to-do-job&#8217; mentality</li>
<li>An open minded performance test analyst (me!) who believes Excel really is the grandpa of charting, R is the grandma of stats, Sparklines are the only way to present time series data to management, ANY tool can simulate load via HTTP/S and that there is no real distinction between good software testers or developers (only hard work separates the best from the worst).</li>
<li>That 2010 come-no-doubt 2011 buzz word&#8230; Cloud</li>
</ol>
<p>As I sit here pluggin&#8217; our alternative approach at Altentee, I can see the rise of other more <a href="http://browsermob.com">successful</a> <a href="http://loadstorm.com">punters</a> taking on the <a href="http://loadstorm.com/2010/price-right-loadrunner">big kids</a>. I sit and [continue to] chuckle at the reaction to LR pricing and LR zealots who will fall on their swords over LR itself. I have come to realise one thing though, it is not about the tool, or even the alternate tool like perhaps I first thought. It is more about the <span style="color: #008000;"><strong>freedom of choice</strong></span>.</p>
<p>To tackle MyHospitals I was free to choose and implement the following tools:</p>
<ol>
<li><a href="https://github.com/90kts/watirgrid">WatirGrid</a> to orchestrate a small flotilla of IE and FireFox based browsers based on <a href="http://watir.com">Watir</a></li>
<li><a href="http://jakarta.apache.org/jmeter/index.html">JMeter</a> to add more at the protocol level of performance testing</li>
<li><a href="http://www.hpl.hp.com/research/linux/httperf/">httperf</a> to do some basic benchmarking, similar to my front page</li>
<li><a href="https://github.com/90kts/numbrcrunchr">numbrcrunchr</a> to pull together system metrics and make for easier analysis</li>
<li>A <a href="https://www.zettagrid.com/index.php/about-news/157-altentee-benchmark-comparisons-between-australian-cloud-providers">variety of Australian cloud providers </a>and of course <a href="http://aws.amazon.com/ec2/pricing/">Amazon EC2</a> to host the test environment</li>
</ol>
<p>It has been a great year. I&#8217;m not entirely free of the commercial chains just yet and am still needing the LR type work to prop up this approach, but I hope 2011 brings about some fresh thinking in performance and test automation with hopefully me somewhere amidst that space.</p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2010/a-year-in-review-and-a-consolidated-approach/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Watir Powered LoadRunner Scripts</title>
		<link>http://altentee.com/blogs/2009/watir-powered-loadrunner-scripts/</link>
		<comments>http://altentee.com/blogs/2009/watir-powered-loadrunner-scripts/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 09:16:31 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[loadrunner]]></category>
		<category><![CDATA[watir]]></category>

		<guid isPermaLink="false">http://90kts.com/blog/2009/watir-powered-loadrunner-scripts/</guid>
		<description><![CDATA[Here&#8217;s an idea&#8230; Ever been in a LoadRunner contract where you&#8217;ve got a ton of scripts to write for business transactions that have many many design steps? Even worse, have you had to write those scripts against a development environment with an unstable code base and shocking performance? Sound familiar? Ever felt the frustration of [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an idea&#8230; Ever been in a LoadRunner contract where you&#8217;ve got a ton of scripts to write for business transactions that have many many design steps?</p>
<p>Even worse, have you had to write those scripts against a development environment with an unstable code base and shocking performance? Sound familiar? Ever felt the frustration of re-recording manual test cases back into LoadRunner in said environments. Why wouldn&#8217;t you just automate the script recording process?</p>
<p><span id="more-254"></span><br />
Well if you&#8217;re in a LoadRunner shop there&#8217;s probably a QTP license floating around. However there&#8217;s a great alternative with Ruby, specifically <a href="http://watir.com"><strong>Web Application Testing In Ruby</strong></a>.</p>
<p>The gist is that you setup your manual test case using a watir script, then re-record your LoadRunner scripts using those watir scripts as the driver. The benefits are many:</p>
<p>1. Reduce user input errors when recording the LoadRunner scripts.<br />
2. Have a consistent way of re-recording LoadRunner scripts based on the same input delivered by the watir script.<br />
3. Diffing for correlation becomes easier because of consistency between multiple recordings of the same script.<br />
4. Watir scripts are easier to maintain than LoadRunner scripts.<br />
5. You can incorporate other Ruby gems into your watir scripts to assist with repetitive tasks during recording. For example, I copy transaction names to the clipboard between each step so I can easily paste them into transaction start timers.<br />
6. Watir scripts can double as a smoke test which you can run in parallel with load tests that use only virtual users.<br />
7. Watir scripts (and sampling response time from a real browser) will incorporate other factors such as client render time. Something which vusers really can&#8217;t do.</p>
<p>Downside is that you need to do a little more preparation than you might have to if you&#8217;re just following a manual test case. Once you have a framework for creating your watir script, this becomes easier. I figure it takes me about 1 hour to script up an end to end transaction that might have around 30 sub transactions (or design steps).</p>
<p>So what do you need to get started?</p>
<p>Firstly to install watir, follow these instructions <a href="http://watir.com/installation/"><strong>here</strong></a>.</p>
<p>Come up with a framework for driving your manual test cases. There&#8217;s plenty of examples out there on how to make bullet proof frameworks driven from a variety of sources. Alister shares some good tips <a href="http://watirmelon.com/2009/09/08/creating-a-watir-framework-using-test-unit-and-roo/"><strong>here</strong></a>.</p>
<p>Here&#8217;s a simple framework to get you started.</p>
<p>I have a helpers class that fires up the browser (attaches to the window that LoadRunner spawns) and some common methods for starting/stopping transaction timers and writing out information to a logfile. It looks like this.<br />
<strong>helpers.rb</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'watir'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'logger'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'win32/clipboard'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'dl'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'win32/sound'</span>
<span style="color:#9966CC; font-weight:bold;">include</span> Win32
&nbsp;
logfile = <span style="color:#996600;">'C:<span style="color:#000099;">\t</span>emp<span style="color:#000099;">\o</span>utput.log'</span>
<span style="color:#0066ff; font-weight:bold;">@log</span> = <span style="color:#CC00FF; font-weight:bold;">Logger</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>logfile, <span style="color:#996600;">'daily'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#0066ff; font-weight:bold;">@log</span>.<span style="color:#9900CC;">info</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\n</span>New test started at &quot;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>.<span style="color:#9900CC;">to_s</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#0066ff; font-weight:bold;">@log</span>.<span style="color:#9900CC;">datetime_format</span> = <span style="color:#996600;">&quot;%H:%M:%S&quot;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># if I want each step to start on the minute</span>
<span style="color:#008000; font-style:italic;"># useful when tracing back through profile logs</span>
<span style="color:#008000; font-style:italic;"># on the target server</span>
<span style="color:#0066ff; font-weight:bold;">@staggered</span> = <span style="color:#0000FF; font-weight:bold;">false</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># pause after each step to prompt you to</span>
<span style="color:#008000; font-style:italic;"># stop a transaction time or start a new one</span>
<span style="color:#0066ff; font-weight:bold;">@pause</span> = <span style="color:#0000FF; font-weight:bold;">false</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># setup a clipboard object to copy transaction names to</span>
<span style="color:#0066ff; font-weight:bold;">@clipboard</span> <span style="color:#006600; font-weight:bold;">||</span>= <span style="color:#6666ff; font-weight:bold;">Win32::Clipboard</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># setup my browser object and attach to a running browser</span>
<span style="color:#008000; font-style:italic;"># spawned by the loadrunner recording engine</span>
<span style="color:#0066ff; font-weight:bold;">@b</span> <span style="color:#006600; font-weight:bold;">||</span>=<span style="color:#6666ff; font-weight:bold;">Watir::IE</span>.<span style="color:#9900CC;">attach</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:title</span>, <span style="color:#006600; font-weight:bold;">/</span>FOOBAR<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># alternatively start a new browser</span>
<span style="color:#008000; font-style:italic;">#~ @b ||=Watir::Browser.new</span>
<span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">visible</span> = <span style="color:#0000FF; font-weight:bold;">true</span>
<span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">speed</span> = <span style="color:#ff3333; font-weight:bold;">:fast</span>
<span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">bring_to_front</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># display a simple message box with a dodgy sound</span>
<span style="color:#008000; font-style:italic;"># to grab your attention</span>
<span style="color:#9966CC; font-weight:bold;">def</span> message_box<span style="color:#006600; font-weight:bold;">&#40;</span>txt, title=APP_TITLE, buttons=<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  5.<span style="color:#9900CC;">upto</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>i<span style="color:#006600; font-weight:bold;">|</span> Sound.<span style="color:#9900CC;">beep</span><span style="color:#006600; font-weight:bold;">&#40;</span>i<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006666;">1000</span>,<span style="color:#006666;">30</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  user32 = DL.<span style="color:#9900CC;">dlopen</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'user32'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  msgbox = user32<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'MessageBoxA'</span>, <span style="color:#996600;">'ILSSI'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  r, rs = msgbox.<span style="color:#9900CC;">call</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0</span>, txt, title, buttons<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#0000FF; font-weight:bold;">return</span> r
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># a start timer method</span>
<span style="color:#9966CC; font-weight:bold;">def</span> timer_start
&nbsp;
  <span style="color:#008000; font-style:italic;"># figure out how long to sleep if staggered start is true</span>
  now = <span style="color:#CC00FF; font-weight:bold;">DateTime</span>.<span style="color:#9900CC;">now</span>
  diff = <span style="color:#006666;">60</span> <span style="color:#006600; font-weight:bold;">-</span> now.<span style="color:#9900CC;">sec</span>
  <span style="color:#CC0066; font-weight:bold;">sleep</span> diff <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@staggered</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># empty clipboard and copy current transaction name to it</span>
  <span style="color:#0066ff; font-weight:bold;">@clipboard</span>.<span style="color:#9900CC;">empty</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#0066ff; font-weight:bold;">@clipboard</span>.<span style="color:#9900CC;">set_data</span><span style="color:#006600; font-weight:bold;">&#40;</span>@t<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># prompt you to start a new transaction if pause is true</span>
  message_box<span style="color:#006600; font-weight:bold;">&#40;</span>@t, <span style="color:#996600;">&quot;Start Transaction&quot;</span>, <span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@pause</span>
&nbsp;
  <span style="color:#0066ff; font-weight:bold;">@start_time</span> = <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># end timer method</span>
<span style="color:#9966CC; font-weight:bold;">def</span> timer_end
  <span style="color:#0066ff; font-weight:bold;">@end_time</span> = <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># prompt you to stpo end a transaction if pause is true</span>
  message_box<span style="color:#006600; font-weight:bold;">&#40;</span>@t, <span style="color:#996600;">&quot;End Transaction&quot;</span>, <span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@pause</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># figure out elapsed time</span>
  <span style="color:#0066ff; font-weight:bold;">@elapsed_time</span> = <span style="color:#006600; font-weight:bold;">&#40;</span>@end_time <span style="color:#006600; font-weight:bold;">-</span> <span style="color:#0066ff; font-weight:bold;">@start_time</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">*</span> <span style="color:#006666;">1000</span>
  tab = <span style="color:#996600;">&quot;<span style="color:#000099;">\t</span>&quot;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># write it all to you logger</span>
  <span style="color:#0066ff; font-weight:bold;">@log</span>.<span style="color:#9900CC;">info</span><span style="color:#006600; font-weight:bold;">&#40;</span>@start_time.<span style="color:#9900CC;">to_f</span>.<span style="color:#9900CC;">to_s</span> <span style="color:#006600; font-weight:bold;">+</span> tab <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#0066ff; font-weight:bold;">@end_time</span>.<span style="color:#9900CC;">to_f</span>.<span style="color:#9900CC;">to_s</span>  <span style="color:#006600; font-weight:bold;">+</span> tab \
  <span style="color:#006600; font-weight:bold;">+</span> tab <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#0066ff; font-weight:bold;">@start_time</span>.<span style="color:#9900CC;">to_s</span> <span style="color:#006600; font-weight:bold;">+</span> tab <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#CC0066; font-weight:bold;">sprintf</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'%-60s'</span>, <span style="color:#0066ff; font-weight:bold;">@t</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">+</span> tab <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#CC0066; font-weight:bold;">sprintf</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'%10s'</span>, <span style="color:#0066ff; font-weight:bold;">@elapsed_time</span>.<span style="color:#9900CC;">to_s</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># a simple sync method to wait for text on a scren</span>
<span style="color:#9966CC; font-weight:bold;">def</span> sync<span style="color:#006600; font-weight:bold;">&#40;</span>text<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#6666ff; font-weight:bold;">Watir::Waiter</span>.<span style="color:#9900CC;">wait_until</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">text</span>.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>text<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Now your manual test case in ruby should look pretty simple. I typically rely on things like the :name, :text or :id attributes of html elements depending on how the application was written by the developers. The manual test case will look something like this.<br />
<strong>001_test_case.rb</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'helpers.rb'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">begin</span>
&nbsp;
  <span style="color:#0066ff; font-weight:bold;">@t</span> = <span style="color:#996600;">&quot;INIT&quot;</span>
  timer_start
  <span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">goto</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'https://foobar/wps/myportal'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  timer_end
&nbsp;
  <span style="color:#0066ff; font-weight:bold;">@t</span> = <span style="color:#996600;">&quot;LOGIN&quot;</span>
  timer_start
  <span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">text_field</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:name</span>, <span style="color:#996600;">&quot;username&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">set</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;yoohoo&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">text_field</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:name</span>, <span style="color:#996600;">&quot;password&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">set</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;foobar&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">button</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:index</span>, <span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">click</span>
  timer_end
&nbsp;
  <span style="color:#0066ff; font-weight:bold;">@t</span> = <span style="color:#996600;">&quot;FOOBAR_03a_03_Tab&quot;</span>
  timer_start
  <span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">link</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:text</span>, <span style="color:#006600; font-weight:bold;">/</span>FOOBAR<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">click</span>
  timer_end
&nbsp;
  <span style="color:#0066ff; font-weight:bold;">@t</span> = <span style="color:#996600;">&quot;FOOBAR_03a_04_FOOBAR_Tab&quot;</span>
  timer_start
  <span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">link</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:text</span>, <span style="color:#006600; font-weight:bold;">/</span>FOOBAR<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">click</span>
  sync<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;New FOOBAR&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  timer_end
&nbsp;
  <span style="color:#0066ff; font-weight:bold;">@t</span> = <span style="color:#996600;">&quot;FOOBAR_03a_27_Record_Notes&quot;</span>
  <span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">text_field</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:id</span>, <span style="color:#996600;">&quot;PC_7_C5L40JR2001F002J5MT98S28H6__L_8_0_1_0_14_1_1&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">set</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Justification&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  timer_start
  <span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">button</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:text</span>, <span style="color:#006600; font-weight:bold;">/</span>Save<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">click</span>
  timer_end
&nbsp;
  <span style="color:#0066ff; font-weight:bold;">@t</span> = <span style="color:#996600;">&quot;FOOBAR_03a_28_Save_And_Foobaz&quot;</span>
  timer_start
  <span style="color:#0066ff; font-weight:bold;">@b</span>.<span style="color:#9900CC;">link</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:text</span>, <span style="color:#006600; font-weight:bold;">/</span>Save <span style="color:#006600; font-weight:bold;">&amp;</span> Foobaz<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">click</span>
  timer_end
&nbsp;
  <span style="color:#008000; font-style:italic;"># etc ...</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#CC00FF; font-weight:bold;">Exception</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> e
  <span style="color:#0066ff; font-weight:bold;">@log</span>.<span style="color:#9900CC;">error</span><span style="color:#006600; font-weight:bold;">&#40;</span>@start_time.<span style="color:#9900CC;">to_i</span>.<span style="color:#9900CC;">to_s</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;<span style="color:#000099;">\t</span>&quot;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#CC0066; font-weight:bold;">sprintf</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'%-60s'</span>, <span style="color:#0066ff; font-weight:bold;">@trans</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;<span style="color:#000099;">\t</span>Error<span style="color:#000099;">\n</span>&quot;</span> <span style="color:#006600; font-weight:bold;">+</span> e<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Running this test case will output a log file to C:\temp\output.log that looks like this.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">New test started at Thu Oct 08 20:37:48 +1100 2009
1254994670.936  1254994671.576          Thu Oct 08 20:37:50 +1100 2009  INIT                                                                 640.0
1254994671.576  1254994678.233          Thu Oct 08 20:37:51 +1100 2009  LOGIN                                                               6657.0
1254994678.233  1254994694.123          Thu Oct 08 20:37:58 +1100 2009  FOOBAR_03a_03_Tab                                          15890.0
1254994694.123  1254994696.014          Thu Oct 08 20:38:14 +1100 2009  FOOBAR_03a_04_FOOBAR_Tab                                      1891.0
1254994717.171  1254994727.608          Thu Oct 08 20:38:37 +1100 2009  FOOBAR_03a_05_Enter_FOOBAR_Type                              10437.0
1254994729.28   1254994743.499          Thu Oct 08 20:38:49 +1100 2009  FOOBAR_03a_06_Search_for_Primary_Person                      14219.0
1254994748.093  1254994767.265          Thu Oct 08 20:39:08 +1100 2009  FOOBAR_03a_07_Associate_Primary_Person                       19172.0
1254994767.265  1254994780.796          Thu Oct 08 20:39:27 +1100 2009  FOOBAR_03a_08_Enter_Primary_Person_Address_Details           13531.0
1254994780.796  1254994818.765          Thu Oct 08 20:39:40 +1100 2009  FOOBAR_03a_09_Enter_Primary_Person_Doc_Details        37969.0
1254994818.765  1254994835.906          Thu Oct 08 20:40:18 +1100 2009  FOOBAR_03a_16_Add_PoC _Link                                     17141.0
1254994838.828  1254994843.515          Thu Oct 08 20:40:38 +1100 2009  FOOBAR_03a_17_Add_PoC                                            4687.0
1254994852.078  1254994855.469          Thu Oct 08 20:40:52 +1100 2009  FOOBAR_03a_18_Search_Agent                                       3391.0
1254994855.469  1254994859.203          Thu Oct 08 20:40:55 +1100 2009  FOOBAR_03a_19_View_Agent                                         3734.0
1254994863.953  1254994876.203          Thu Oct 08 20:41:03 +1100 2009  FOOBAR_03a_20_Associate_Agent                                   12250.0
1254994876.203  1254994879.484          Thu Oct 08 20:41:16 +1100 2009  FOOBAR_03a_21_Add_Payment_Link                                   3281.0
1254994894.094  1254994894.703          Thu Oct 08 20:41:34 +1100 2009  FOOBAR_03a_22_Record_Payment_Details                              609.0
1254995196.611  1254995196.611          Thu Oct 08 20:46:36 +1100 2009  SAP                                                                    0.0
1254995202.486  1254995258.517          Thu Oct 08 20:46:42 +1100 2009  FOOBAR_03a_25_ Run Validity Assessment                          56031.0
1254995267.736  1254995280.017          Thu Oct 08 20:47:47 +1100 2009  FOOBAR_03a_27_Record_Notes                                      12281.0
1254995280.017  1254995346.579          Thu Oct 08 20:48:00 +1100 2009  FOOBAR_03a_28_Save_And_Foobaz                                    66562.0</pre></div></div>

<p>Which gives you things like start and stop times, elapsed times and action names to help you debug things further down the track.</p>
<p>All up I think it&#8217;s a pretty neat solution for re-re-re-recording LoadRunner scripts (or your tool of choice) you inevitably face in fast changing environments. Whilst writing this post I had a script ticking away in the background recording some 3000+ LoadRunner events. YMMV.</p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2009/watir-powered-loadrunner-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Regex Search and Replace in LoadRunner</title>
		<link>http://altentee.com/blogs/2009/regex-search-and-replace-in-loadrunner/</link>
		<comments>http://altentee.com/blogs/2009/regex-search-and-replace-in-loadrunner/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 05:23:45 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[loadrunner]]></category>

		<guid isPermaLink="false">http://90kts.com/blog/2009/regex-search-and-replace-in-loadrunner/</guid>
		<description><![CDATA[Previously I identified how to setup pattern matching with Regex in LoadRunner. Here&#8217;s how you implement search and replace functionality with the same POSIX libraries used in the previous example. Create a replace function in your favourite headers file or wherever you keep your framework&#8217;y stuff&#8230; You also need the pcre3.dll and pcreposix.h header added [...]]]></description>
			<content:encoded><![CDATA[<p><strong><a href="http://90kts.com/blog/2008/regex-pattern-matching-in-loadrunner/">Previously </a></strong>I identified how to setup pattern matching with Regex in LoadRunner.</p>
<p>Here&#8217;s how you implement search and replace functionality with the same POSIX libraries used in the previous example.</p>
<p>Create a replace function in your favourite headers file or wherever you keep your framework&#8217;y stuff&#8230; You also need the pcre3.dll and pcreposix.h header added as files to your script.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">replace<span style="color: #009900;">&#40;</span><span style="color: #993333;">const</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span><span style="color: #993333;">string</span><span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>pattern<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>replace<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>match<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #993333;">int</span> length<span style="color: #339933;">;</span>
   <span style="color: #993333;">int</span>  status<span style="color: #339933;">;</span>
   <span style="color: #993333;">int</span>  eflag<span style="color: #339933;">;</span>
   <span style="color: #993333;">char</span> buf<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span>
   <span style="color: #993333;">char</span> out<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
   regex_t re<span style="color: #339933;">;</span>
   regmatch_t pmatch<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">128</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
   lr_load_dll<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;pcre3.dll&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>status <span style="color: #339933;">=</span> regcomp<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>re<span style="color: #339933;">,</span> pattern<span style="color: #339933;">,</span> REG_EXTENDED<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      regerror<span style="color: #009900;">&#40;</span>status<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>re<span style="color: #339933;">,</span> buf<span style="color: #339933;">,</span> <span style="color: #0000dd;">120</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      lr_output_message<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Match PCRE Exit 2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">2</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>status <span style="color: #339933;">=</span> regexec<span style="color: #009900;">&#40;</span> <span style="color: #339933;">&amp;</span>re<span style="color: #339933;">,</span> <span style="color: #993333;">string</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> pmatch<span style="color: #339933;">,</span> eflag<span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      strncat<span style="color: #009900;">&#40;</span>out<span style="color: #339933;">,</span> <span style="color: #993333;">string</span><span style="color: #339933;">,</span> pmatch<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #202020;">rm_so</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      strcat<span style="color: #009900;">&#40;</span>out<span style="color: #339933;">,</span> replace<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #993333;">string</span> <span style="color: #339933;">+=</span> pmatch<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #202020;">rm_eo</span><span style="color: #339933;">;</span>
      eflag <span style="color: #339933;">=</span> REG_NOTBOL<span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
   strcat<span style="color: #009900;">&#40;</span>out<span style="color: #339933;">,</span> <span style="color: #993333;">string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   lr_save_string<span style="color: #009900;">&#40;</span>out<span style="color: #339933;">,</span> match<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Then anywhere in your actions you can call on this function, passing it the string buffer you wish to operate on, a search value, a replace value and the name of the LoadRunner parameter you want the result saved into.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">lr_save_string<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;FOO%20BAR%20DING&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;buffer&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
replace<span style="color: #009900;">&#40;</span>lr_eval_string<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;{buffer}&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;%20&quot;</span><span style="color: #339933;">,</span><span style="color: #ff0000;">&quot; &quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;custom&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>What you&#8217;ll end up with is something like this:</p>
<p><code><br />
Home.c(6): Notify: Saving Parameter "buffer = FOO%20BAR%20DING"<br />
Home.c(7): Notify: Parameter Substitution: parameter "buffer" =  "FOO%20BAR%20DING"<br />
framework.h(135): Notify: Saving Parameter "custom = FOO BAR DING"<br />
</code></p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2009/regex-search-and-replace-in-loadrunner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improved SPNEGO or Kerberos support with LoadRunner</title>
		<link>http://altentee.com/blogs/2009/improved-spnego-or-kerberos-support-with-loadrunner/</link>
		<comments>http://altentee.com/blogs/2009/improved-spnego-or-kerberos-support-with-loadrunner/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 05:12:29 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[loadrunner]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://90kts.com/blog/2009/improved-spnego-or-kerberos-support-with-loadrunner/</guid>
		<description><![CDATA[Previously I identified a way in which to test SPNEGO or Kerberos authentication with LoadRunner. However this implementation was buggy in the sense that if you ran your load tests under reasonable load with the WinInet replay engine (instead of sockets) you were likely to encounter the following error: Error -27492: "HttpSendRequest" failed, Windows error [...]]]></description>
			<content:encoded><![CDATA[<p><strong><a href="http://90kts.com/blog/2008/performance-testing-spnego-or-kerberos-with-loadrunner/">Previously </a></strong>I identified a way in which to test SPNEGO or Kerberos authentication with LoadRunner. However this implementation was buggy in the sense that if you ran your load tests under reasonable load with the WinInet replay engine (instead of sockets) you were likely to encounter the following error:</p>
<p><code>Error -27492: "HttpSendRequest" failed, Windows error code=12057 (certificate revoked) and retry limit (0) exceeded for URL="<br />
https://someplacesecure.com.au/secure.html", Snapshot Info [MSH 1 2]</code></p>
<p>This error occurs when using WinInet replay instead of sockets with Integrated Authentication enabled in run-time settings. The purpose of this was to allow vusers to use SSO with SPNEGO authentication in an IBM WebSEAL environment.</p>
<p>After spending some time with the mystical HP level 3 support, they identified an undocumented flag which helps out significantly in this. So, instead of using the WinInet replay engine (which is not encouraged by HP) you should do something similar to the following.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">vuser_init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Preferred run-time settings</span>
	<span style="color: #666666; font-style: italic;">// Browser -&gt; Browser Emulation</span>
       <span style="color: #666666; font-style: italic;">// [ ] Simulate a new user on each iteration</span>
       <span style="color: #666666; font-style: italic;">// Preferences -&gt; Options</span>
       <span style="color: #666666; font-style: italic;">// Enable Integration Authentication [Yes]</span>
&nbsp;
	web_set_sockets_option<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;INITIAL_BASIC_AUTH&quot;</span><span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	web_set_user<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;DOMAIN.LOCAL\\username&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;password&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;someplacesecure.com.au:443&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	web_url<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;myportal&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;URL=https://someplacesecure.com.au/wps&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;Resource=0&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;Referer=&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;Mode=HTML&quot;</span><span style="color: #339933;">,</span>
		LAST<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The magic is in the <code>web_set_sockets_option("INITIAL_BASIC_AUTH","1")</code> flag. Set that and you can then use LoadRunner in Sockets mode which as it turns out, is much more stable.</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2009/improved-spnego-or-kerberos-support-with-loadrunner/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Sharing Data Between LoadRunner VUser Groups</title>
		<link>http://altentee.com/blogs/2009/sharing-data-between-loadrunner-vuser-groups/</link>
		<comments>http://altentee.com/blogs/2009/sharing-data-between-loadrunner-vuser-groups/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 09:32:32 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[loadrunner]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://90kts.com/blog/2009/sharing-data-between-loadrunner-vuser-groups/</guid>
		<description><![CDATA[When running multiple vuser groups with the same script i.e. If that script references a data file (for parameters) then that data file is shared by *all* vuser groups. e.g. my parameter called {values} has When running, vuser group_b will error with these settings e.g. i.e. So 2 separate vuser groups still equals one shared [...]]]></description>
			<content:encoded><![CDATA[<p>When running multiple vuser groups with the same script i.e.<br />
<a href='http://90kts.com/blog/wp-content/uploads/2009/02/pic11875.jpg' title='11875'><img src='http://90kts.com/blog/wp-content/uploads/2009/02/pic11875.jpg' alt='11875' /></a></p>
<p>If that script references a data file (for parameters) then that data file is shared by *all* vuser groups.<br />
e.g. my parameter called {values} has<br />
<a href='http://90kts.com/blog/wp-content/uploads/2009/02/pic24149.jpg' title='21419'><img src='http://90kts.com/blog/wp-content/uploads/2009/02/pic24149.jpg' alt='21419' /></a><br />
<a href='http://90kts.com/blog/wp-content/uploads/2009/02/pic18190.jpg' title='18190'><img src='http://90kts.com/blog/wp-content/uploads/2009/02/pic18190.jpg' alt='18190' /></a></p>
<p>When running, vuser group_b will error with these settings e.g.<br />
<a href='http://90kts.com/blog/wp-content/uploads/2009/02/pic03946.jpg' title='3946'><img src='http://90kts.com/blog/wp-content/uploads/2009/02/pic03946.jpg' alt='3946' /></a></p>
<p>i.e.<br />
<a href='http://90kts.com/blog/wp-content/uploads/2009/02/pic10798.jpg' title='748'><img src='http://90kts.com/blog/wp-content/uploads/2009/02/pic10798.jpg' alt='748' /></a></p>
<p>So 2 separate vuser groups still equals one shared parameter file (and settings).<br />
Watch out for this!</p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2009/sharing-data-between-loadrunner-vuser-groups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Alternative to LoadRunner Licenses</title>
		<link>http://altentee.com/blogs/2008/an-alternative-to-loadrunner-licenses/</link>
		<comments>http://altentee.com/blogs/2008/an-alternative-to-loadrunner-licenses/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 19:24:30 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[humour]]></category>
		<category><![CDATA[loadrunner]]></category>

		<guid isPermaLink="false">http://90kts.com/blog/2008/an-alternative-to-loadrunner-licenses/</guid>
		<description><![CDATA[No this is not a post on how to get free licenses&#8230; There should be no doubt that purchasing LoadRunner licenses is expensive. How Mercury/HP has achieved this stranglehold on the market is strange to behold but it is the way it is. Needless to say, in another purchasing license cycle I jokingly said to [...]]]></description>
			<content:encoded><![CDATA[<p>No this is not a post on how to get free licenses&#8230;</p>
<p>There should be no doubt that purchasing LoadRunner licenses is <strong>expensive</strong>. How Mercury/HP has achieved this stranglehold on the market is strange to behold but it is the way it is.</p>
<p>Needless to say, in another purchasing license cycle I jokingly said to a colleague that it would probably be cheaper to fly to India, hire some office space and PCs, give some training to 100 production workers and pay them 3 months wage to facilitate your whole test effort using real people and PCs. You&#8217;d still probably come out ahead of a typical yearly budget for HP products&#8230; Or would you?<br />
<span id="more-214"></span></p>
<p><em>Estimates in AUD&#8230;</em><br />
<a href="http://news.bbc.co.uk/2/hi/business/4436692.stm">Average Indian production worker yearly salary</a>, $2,192<br />
<a href="http://www.viviun.com/">Office space in Pune per month</a>, $753<br />
<a href="http://www.qantas.com">Return business class flights for me and a business partner/trainer</a>, $12,000<br />
<a href="http://pcrentalindia.com">Rental PC/laptop fleet per month</a>, $10,000</p>
<p><strong>Average cost of test effort over 3 months would be $105,000</strong></p>
<p>I think you might come out with some change from that&#8230; <img src='http://altentee.com/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2008/an-alternative-to-loadrunner-licenses/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Performance Testing SPNEGO or Kerberos with LoadRunner</title>
		<link>http://altentee.com/blogs/2008/performance-testing-spnego-or-kerberos-with-loadrunner/</link>
		<comments>http://altentee.com/blogs/2008/performance-testing-spnego-or-kerberos-with-loadrunner/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 08:15:39 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[loadrunner]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://90kts.com/blog/2008/performance-testing-spnego-or-kerberos-with-loadrunner/</guid>
		<description><![CDATA[Alas, it can&#8217;t be done in JMeter. So this is how it works in LoadRunner &#8230; This challenge came up recently and we were able to figure out how to test SPNEGO or Kerberos using Integrated Windows Authentication with LoadRunner. To test this I built a VM with Win2K3, an AD domain and IIS6. To [...]]]></description>
			<content:encoded><![CDATA[<p>Alas, it can&#8217;t be done in JMeter. So this is how it works in LoadRunner &#8230;<br />
This challenge came up recently and we were able to figure out how to test SPNEGO or Kerberos using Integrated Windows Authentication with LoadRunner.<br />
<span id="more-209"></span><br />
To test this I built a VM with Win2K3, an AD domain and IIS6. To enforce kerberos only authentication I modified IIS as per the following:<br />
<a href='http://90kts.com/blog/wp-content/uploads/2008/10/kerb1.png' title='kerb1.png'><img src='http://90kts.com/blog/wp-content/uploads/2008/10/kerb1.png' alt='kerb1.png' /></a></p>
<p>I didn&#8217;t have WebSEAL (which is what I was ultimately trying to simulate) but I believe this is reasonably close, to quote:</p>
<blockquote><p>Integrated Windows authentication uses Kerberos v5 authentication and NTLM authentication. Kerberos is an industry-standard authentication protocol that is used to verify user or host identity. If Active Directory is installed on a domain controller running Windows 2000 Server or Windows Server 2003, and the client browser supports the Kerberos v5 authentication protocol, Kerberos v5 authentication is used; otherwise, NTLM authentication is used.</p></blockquote>
<p>So to log on to my test page I needed to provide domain credentials in IE. I also made sure my client IE enforces IWA as per the following:<br />
<a href='http://90kts.com/blog/wp-content/uploads/2008/10/kerb2.png' title='kerb2.png'><img src='http://90kts.com/blog/wp-content/uploads/2008/10/kerb2.png' alt='kerb2.png' /></a></p>
<p>If I don&#8217;t provide my domain credentials (in this case: smallbusiness\fred) then I get knocked back with a 401 as expected.</p>
<p>On generation of my LR script the first response is a 401.2. It then does a second request with the authorization header i.e.<br />
<code>Authorization: Negotiate TlRMTVNTUAABAAAAB4IIogAAAAAAAAAAAAAAAAAAAAAFAs4OAAAADw==</code></p>
<p>The response header to this tells me to authenticate i.e.<br />
<code>WWW-Authenticate: Negotiate TlRMTVNTUAACAAAAGgAaADgAAAAFgomir1xcxf5zo2MAAAAAAAAAAOIA4gBSAAAABQLODgAAAA9TAE0AQQBMAEwAQgBVAFMASQBOAEUAUwBTAAIAGgBTAE0AQQBMAEwAQgBVAFMASQBOAEUAUwBTAAEAHgBLAE8ATwBQAFMALQA5ADYAWABZADIAVwBEAFUANgAEACYAcwBtAGEAbABsAGIAdQBzAGkAbgBlAHMAcwAuAGwAbwBjAGEAbAADAEYAawBvAG8AcABzAC0AOQA2AHgAeQAyAHcAZAB1ADYALgBzAG0AYQBsAGwAYgB1AHMAaQBuAGUAcwBzAC4AbABvAGMAYQBsAAUAJgBzAG0AYQBsAGwAYgB1AHMAaQBuAGUAcwBzAC4AbABvAGMAYQBsAAAAAAA=</code></p>
<p>The next request authorizes presumably with the correct token i.e.<br />
<code>Authorization: Negotiate TlRMTVNTUAADAAAAGAAYAIgAAAAYABgAoAAAABoAGgBIAAAACAAIAGIAAAAeAB4AagAAAAAAAAC4AAAABYKIogUCzg4AAAAPcwBtAGEAbABsAGIAdQBzAGkAbgBlAHMAcwBmAHIAZQBkAEsATwBPAFAAUwAtADkANgBYAFkAMgBXAEQAVQA2AB15bTxE3i63AAAAAAAAAAAAAAAAAAAAALQ6IC82wYIBXpniDchRG9zSW8/bC4891w==</code></p>
<p>From which the response is gravy, and my homepage loads.<br />
So the recording process looks like it went through the necessary authentication steps.</p>
<p>Now in my LR script Action() I can set the domain credentials dynamically with web_set_user (hence emulate multiple users) i.e.<br />
<code>web_set_user("smallbusiness\\fred","********", "smallbusiness.local:80");</code></p>
<p>Then follow with a web_url request to the server i.e.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">	web_url<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;smallbusiness.local&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;URL=http://smallbusiness.local/&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;Resource=0&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;RecContentType=text/html&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;Referer=&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;Snapshot=t1.inf&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;Mode=HTML&quot;</span><span style="color: #339933;">,</span>
		LAST<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Play that back and it fails. (Assuming WebSEAL will reject NTLM which in this case my test rig won&#8217;t, but I can make that assumption&#8230;)</p>
<p>Now change a couple of runtime settings:<br />
Internet Protocol->Preferences->Options->Authentication->Enable Integrated Authentication<br />
<a href='http://90kts.com/blog/wp-content/uploads/2008/10/kerb3.png' title='kerb3.png'><img src='http://90kts.com/blog/wp-content/uploads/2008/10/kerb3.png' alt='kerb3.png' /></a></p>
<p>This makes sure that when the server asks for authentication via the first 401.2/1, that SPNEGO/Negotiate/Kerberos is tried *first* before any other protocol (like NTLM)</p>
<p>You also need to change:<br />
Internet Protocol->Preferences->Advanced->WinInet [checked]:<br />
<a href='http://90kts.com/blog/wp-content/uploads/2008/10/kerb4.png' title='kerb4.png'><img src='http://90kts.com/blog/wp-content/uploads/2008/10/kerb4.png' alt='kerb4.png' /></a></p>
<p>This instructs VuGen to use the WinInet replay engine instead of the standard Sockets replay. VuGen has two HTTP replay engines: Sockets-based (default) or WinInet based. The WinInet is the engine used by Internet Explorer and it supports all of the features incorporated into the IE browser. I think this *better* emulates the IE client settings for IWA &#8230;</p>
<p>And re-run the script. I now get past the authentication using Kerberos and successfully load my home page&#8230; This can be repeated for WebSEAL provided you first do a web_set_user (so it knows what domain credentials to use) which effectively lets you run the test with multiple users&#8230; Great for testing those WebSEAL/SPNEGO/Kerberos single sign on solutions&#8230; <img src='http://altentee.com/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2008/performance-testing-spnego-or-kerberos-with-loadrunner/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Performance Testing MQ with LoadRunner</title>
		<link>http://altentee.com/blogs/2008/performance-testing-mq-with-loadrunner/</link>
		<comments>http://altentee.com/blogs/2008/performance-testing-mq-with-loadrunner/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 06:04:50 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[loadrunner]]></category>
		<category><![CDATA[MQ]]></category>

		<guid isPermaLink="false">http://90kts.com/blog/2008/performance-testing-mq-with-loadrunner/</guid>
		<description><![CDATA[The wheel has turned full circle and I&#8217;m back in MQ land&#8230; So here is a a simple Java vuser harness which you can use in LoadRunner to put or get messages from Websphere MQ. This version doesn&#8217;t require any JNDI bindings (or access to JMS). Instead it just uses a standard server connection channel [...]]]></description>
			<content:encoded><![CDATA[<p>The wheel has turned full circle and I&#8217;m back in MQ land&#8230; So here is a a simple Java vuser harness which you can use in LoadRunner to put or get messages from Websphere MQ. This version doesn&#8217;t require any JNDI bindings (or access to JMS). Instead it just uses a standard server connection channel over TCP to get and put messages.</p>
<p>You will need to get the following jars from your Websphere MQ installation:<br />
1. com.ibm.mq.jar<br />
2. connector.jar<br />
3. jta.jar</p>
<p>Make sure you include them in your run-time settings (F4) for your script:<br />
<a href='http://90kts.com/blog/wp-content/uploads/2008/10/runtim-java-mq.png' title='Runtime settings Java vuser MQ'><img src='http://90kts.com/blog/wp-content/uploads/2008/10/runtim-java-mq.png' alt='Runtime settings Java vuser MQ' /></a><br />
<span id="more-207"></span></p>
<p><strong>PUT example</strong></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
 * LoadRunner Java script. (Build: 946)
 *
 * Script Description: simple test harness to PUT messages on a MQ queue
 * Author: Tim.Koopmans@90kts.com
 */</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">lrapi.lr</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.ibm.mq.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Actions
<span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> MQQueueManager myQueueManager<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> MQPutMessageOptions myPutMsgOptions<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> MQQueue myQueue<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Throwable</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
	    MQEnvironment.<span style="color: #006633;">hostname</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;192.168.145.131&quot;</span><span style="color: #339933;">;</span>
	    MQEnvironment.<span style="color: #006633;">properties</span>.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>MQC.<span style="color: #006633;">TRANSPORT_PROPERTY</span>,MQC.<span style="color: #006633;">TRANSPORT_MQSERIES_CLIENT</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    MQEnvironment.<span style="color: #006633;">channel</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;S_koops_5a7610a22&quot;</span><span style="color: #339933;">;</span>
	    MQEnvironment.<span style="color: #006633;">port</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1414</span><span style="color: #339933;">;</span>
	    MQEnvironment.<span style="color: #006633;">CCSID</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">437</span><span style="color: #339933;">;</span>
&nbsp;
	    myQueueManager <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MQQueueManager<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;QM_koops_5a7610a22&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #000066; font-weight: bold;">int</span> openOptions <span style="color: #339933;">=</span> MQC.<span style="color: #006633;">MQOO_OUTPUT</span>
			    <span style="color: #339933;">|</span> MQC.<span style="color: #006633;">MQOO_INQUIRE</span>
			    <span style="color: #339933;">|</span> MQC.<span style="color: #006633;">MQOO_FAIL_IF_QUIESCING</span><span style="color: #339933;">;</span>
&nbsp;
	    myQueue <span style="color: #339933;">=</span> myQueueManager.<span style="color: #006633;">accessQueue</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;default&quot;</span>, openOptions, <span style="color: #000066; font-weight: bold;">null</span>, <span style="color: #000066; font-weight: bold;">null</span>, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	    myPutMsgOptions <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MQPutMessageOptions<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    myPutMsgOptions.<span style="color: #006633;">options</span> <span style="color: #339933;">=</span> MQC.<span style="color: #006633;">MQPMO_NONE</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #666666; font-style: italic;">//end of init</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> action<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Throwable</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
	    MQMessage myPutMessage <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MQMessage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    myPutMessage.<span style="color: #006633;">clearMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    myPutMessage.<span style="color: #006633;">persistence</span> <span style="color: #339933;">=</span> MQC.<span style="color: #006633;">MQPER_PERSISTENT</span><span style="color: #339933;">;</span>
	    <span style="color: #666666; font-style: italic;">//myPutMessage.persistence = MQC.MQPER_NOT_PERSISTENT;</span>
	    myPutMessage.<span style="color: #006633;">correlationId</span> 	<span style="color: #339933;">=</span> MQC.<span style="color: #006633;">MQCI_NONE</span><span style="color: #339933;">;</span>
	    myPutMessage.<span style="color: #006633;">messageId</span> 	<span style="color: #339933;">=</span> MQC.<span style="color: #006633;">MQMI_NONE</span><span style="color: #339933;">;</span>
	    myPutMessage.<span style="color: #006633;">writeString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;xml&gt;&lt;data&gt;foobar&lt;/data&gt;&lt;/xml&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    myQueue.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>myPutMessage, myPutMsgOptions<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>MQException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #666666; font-style: italic;">//end of action</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> end<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Throwable</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
	     myQueue.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	     myQueueManager.<span style="color: #006633;">disconnect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #666666; font-style: italic;">//end of end</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>GET example</strong><br />
I&#8217;ve included a private method which decodes the hex string (for the msgID) into ascii. You can also get creative here. In previous test efforts I&#8217;ve embedded a date time string in the user data of the request message, then extracted and got the difference from the MQMD header on the reply queue. In other words, elapsed time between request and response. I&#8217;m keeping it simple for the example though &#8230; <img src='http://altentee.com/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
 * LoadRunner Java script. (Build: 946)
 *
 * Script Description: simple test harness to GET messages on a MQ queue
 * Author: Tim.Koopmans@90kts.com
 */</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">lrapi.lr</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.ibm.mq.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Actions
<span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> MQQueueManager myQueueManager<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> MQPutMessageOptions myPutMsgOptions<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> MQQueue myQueue<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Throwable</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
	    MQEnvironment.<span style="color: #006633;">hostname</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;192.168.145.131&quot;</span><span style="color: #339933;">;</span>
	    MQEnvironment.<span style="color: #006633;">properties</span>.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>MQC.<span style="color: #006633;">TRANSPORT_PROPERTY</span>,MQC.<span style="color: #006633;">TRANSPORT_MQSERIES_CLIENT</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    MQEnvironment.<span style="color: #006633;">channel</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;S_koops_5a7610a22&quot;</span><span style="color: #339933;">;</span>
	    MQEnvironment.<span style="color: #006633;">port</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1414</span><span style="color: #339933;">;</span>
	    MQEnvironment.<span style="color: #006633;">CCSID</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">437</span><span style="color: #339933;">;</span>
&nbsp;
	    myQueueManager <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MQQueueManager<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;QM_koops_5a7610a22&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #000066; font-weight: bold;">int</span> openOptions <span style="color: #339933;">=</span> MQC.<span style="color: #006633;">MQOO_INPUT_SHARED</span>
                            <span style="color: #339933;">|</span> MQC.<span style="color: #006633;">MQOO_INQUIRE</span>
                            <span style="color: #339933;">|</span> MQC.<span style="color: #006633;">MQOO_FAIL_IF_QUIESCING</span><span style="color: #339933;">;</span>
&nbsp;
	    myQueue <span style="color: #339933;">=</span> myQueueManager.<span style="color: #006633;">accessQueue</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;default&quot;</span>, openOptions<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #666666; font-style: italic;">//end of init</span>
&nbsp;
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> action<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Throwable</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
	    MQMessage myGetMessage <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MQMessage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            myQueue.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>myGetMessage<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;MSG ID: <span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">+</span>dumpHexId<span style="color: #009900;">&#40;</span>myGetMessage.<span style="color: #006633;">messageId</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;CORREL ID: <span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">+</span>dumpHexId<span style="color: #009900;">&#40;</span>myGetMessage.<span style="color: #006633;">correlationId</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;MSG LENGTH:<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">+</span>myGetMessage.<span style="color: #006633;">getMessageLength</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot; bytes&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;MSG CONTENT: &quot;</span><span style="color: #339933;">+</span>myGetMessage.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>MQException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #666666; font-style: italic;">//end of action</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> end<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Throwable</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
	     myQueue.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	     myQueueManager.<span style="color: #006633;">disconnect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #666666; font-style: italic;">//end of end</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> dumpHexId<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> myId<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003399;">String</span> hexAscii <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> myId.<span style="color: #006633;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #000066; font-weight: bold;">char</span> b <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">char</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>myId<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span> 0xFF<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>b <span style="color: #339933;">&lt;</span> 0x10<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		hexAscii <span style="color: #339933;">=</span> hexAscii <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #339933;">;</span>
	    <span style="color: #009900;">&#125;</span>
	    hexAscii <span style="color: #339933;">=</span> hexAscii <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span>.<span style="color: #006633;">toHexString</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toUpperCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">return</span> hexAscii<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #666666; font-style: italic;">//end of dumpHexId</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2008/performance-testing-mq-with-loadrunner/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>How to Generate Random Alphas in LoadRunner</title>
		<link>http://altentee.com/blogs/2008/how-to-generate-random-alphas-in-loadrunner/</link>
		<comments>http://altentee.com/blogs/2008/how-to-generate-random-alphas-in-loadrunner/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 21:38:55 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[loadrunner]]></category>

		<guid isPermaLink="false">http://90kts.com/blog/2008/how-to-generate-random-alphas-in-loadrunner/</guid>
		<description><![CDATA[Just a quick post for myself so I don&#8217;t forget&#8230; I needed to generate a random alpha for use in a LoadRunner web vuser script. The native LoadRunner parameters can do random numerics and date/times but I couldn&#8217;t find a way to generate only characters, as one might need to generate a random password for [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick post for myself so I don&#8217;t forget&#8230; I needed to generate a random alpha for use in a LoadRunner web vuser script. The native LoadRunner parameters can do random numerics and date/times but I couldn&#8217;t find a way to generate only characters, as one might need to generate a random password for example.</p>
<p>So a quick hack to do it in C is as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="c" style="font-family:monospace;">random_alpha<span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span><span style="color: #339933;">*</span> param_name<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> length<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">char</span> buff<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">32</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #993333;">int</span> r<span style="color: #339933;">,</span>i<span style="color: #339933;">;</span>
  <span style="color: #993333;">char</span> c<span style="color: #339933;">;</span>
  srand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">unsigned</span> <span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span>time<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Seed number for rand()</span>
  <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> length<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// A-Z = 65-90 = rand() % 25 + 65</span>
    r <span style="color: #339933;">=</span> rand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #0000dd;">25</span> <span style="color: #339933;">+</span> <span style="color: #0000dd;">65</span><span style="color: #339933;">;</span>
    c <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span><span style="color: #009900;">&#41;</span>r<span style="color: #339933;">;</span>
		buff<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> c<span style="color: #339933;">;</span>
    <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%c&quot;</span><span style="color: #339933;">,</span> c<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  lr_save_string<span style="color: #009900;">&#40;</span>buff<span style="color: #339933;">,</span> param_name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>I keep that as part of my functions library (referenced in globals.h) and can call on it in a script using the following syntax.<br />
<code>random_alpha(char* param_name, int length)</code></p>
<p>Example:<br />
<code>random_alpha("advertiser_name_suffix", 4);</code></p>
<p>Returns:<br />
<code>Notify: Saving Parameter "advertiser_name_suffix = SDNG"</code></p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2008/how-to-generate-random-alphas-in-loadrunner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SFTP with LoadRunner Java Vusers</title>
		<link>http://altentee.com/blogs/2008/using-sftp-with-loadrunner-java-vusers/</link>
		<comments>http://altentee.com/blogs/2008/using-sftp-with-loadrunner-java-vusers/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 03:12:14 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[loadrunner]]></category>

		<guid isPermaLink="false">http://90kts.com/blog/2008/using-sftp-with-loadrunner-java-vusers/</guid>
		<description><![CDATA[Recently had a requirement to construct a LoadRunner harness that could sftp files (over ssh) to and from remote servers. As some of the harnesses were already written in Java (for loading of JMS queues) it made sense to use a Java Vuser to achieve the result required. A work colleague found a knowledge base [...]]]></description>
			<content:encoded><![CDATA[<p>Recently had a requirement to construct a LoadRunner harness that could sftp files (over ssh) to and from remote servers. As some of the harnesses were already written in Java (for loading of JMS queues) it made sense to use a Java Vuser to achieve the result required.</p>
<p>A work colleague found a knowledge base reference that recommended using an RTE Vuser for secure FTP recording and replay. Document ID 41820 refers. I don&#8217;t know, but that seemed like a <a href="http://en.wikipedia.org/wiki/Kludge">kludge</a> to me, and I wasn&#8217;t keen on a multi-protocol harness, so we went searching on Google for a Java alternative.<br />
<span id="more-152"></span></p>
<p>A common recommendation in Java forums pointed towards using <a href="http://www.jcraft.com/jsch/">JSch</a>, or Java Secure Channel. To quote:</p>
<blockquote><p>JSch is a pure Java implementation of <a href="http://ietf.org/html.charters/secsh-charter.html">SSH2</a>.<br />
JSch allows you to connect to an sshd server and use port forwarding, X11 forwarding, file transfer, etc., and you can integrate its functionality into your own Java programs. JSch is licensed under a <a href="http://www.jcraft.com/jsch/LICENSE.txt">BSD style license</a>.</p></blockquote>
<p>So, no clunky RTE scripting and no additional $$$ required. On with the solution &#8230;</p>
<p>You will need the latest jar, we used jsch-0.1.37.jar which is <a href="http://downloads.sourceforge.net/jsch/jsch-0.1.37.jar?modtime=1200969647&#038;big_mirror=0">available here</a>. Copy that to your LoadRunner <code><installdir>/classes</code> subdirectory.</p>
<p>Create a new Java Vuser script and modify its run-time settings (F4). You need to modify the classpath settings and include your jsch jar file.<br />
<a href='http://90kts.com/blog/wp-content/uploads/2008/06/runtim_jsch.jpg' title='Runtime JSCH'><img src='http://90kts.com/blog/wp-content/uploads/2008/06/runtim_jsch.jpg' alt='Runtime JSCH' /></a></p>
<p>Import the relevant package into your script.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="c" style="font-family:monospace;">import com.<span style="color: #202020;">jcraft</span>.<span style="color: #202020;">jsch</span>.<span style="color: #339933;">*;</span></pre></td></tr></table></div>

<p>Then add the relevant code to your action method. Following is an example of how to do a get from an sftp server. As we progress I&#8217;ll add more examples for other functions you might use. You can also check out the many examples provided <a href="http://www.jcraft.com/jsch/examples/Sftp.java">here</a>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="c" style="font-family:monospace;">    public <span style="color: #993333;">int</span> action<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#123;</span>
	JSch jsch<span style="color: #339933;">=</span>new JSch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	String host<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;myremotehost&quot;</span><span style="color: #339933;">;</span>
	String user<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;myuser&quot;</span><span style="color: #339933;">;</span>
	String pwd<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;mypwd&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #993333;">int</span> port<span style="color: #339933;">=</span><span style="color: #0000dd;">22</span><span style="color: #339933;">;</span>
	try <span style="color: #009900;">&#123;</span>
	    Session session<span style="color: #339933;">=</span>jsch.<span style="color: #202020;">getSession</span><span style="color: #009900;">&#40;</span>user<span style="color: #339933;">,</span> host<span style="color: #339933;">,</span> port<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            session.<span style="color: #202020;">setPassword</span><span style="color: #009900;">&#40;</span> pwd <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    java.<span style="color: #202020;">util</span>.<span style="color: #202020;">Properties</span> config<span style="color: #339933;">=</span>new java.<span style="color: #202020;">util</span>.<span style="color: #202020;">Properties</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #666666; font-style: italic;">// Don't bother checking for unknown host keys: UnknownHostKey</span>
	    config.<span style="color: #202020;">put</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;StrictHostKeyChecking&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;no&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    session.<span style="color: #202020;">setConfig</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    session.<span style="color: #202020;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	    <span style="color: #666666; font-style: italic;">// SFTP get</span>
            Channel channel<span style="color: #339933;">=</span>session.<span style="color: #202020;">openChannel</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;sftp&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    channel.<span style="color: #202020;">setXForwarding</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #666666; font-style: italic;">//Connect to the site.</span>
	    channel.<span style="color: #202020;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	    ChannelSftp c<span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span>ChannelSftp<span style="color: #009900;">&#41;</span>channel<span style="color: #339933;">;</span>
	    c.<span style="color: #202020;">cd</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;/tmp&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    c.<span style="color: #202020;">lcd</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;D:/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #993333;">int</span> mode<span style="color: #339933;">=</span>ChannelSftp.<span style="color: #202020;">OVERWRITE</span><span style="color: #339933;">;</span>
	    c.<span style="color: #202020;">get</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;test.txt&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;get_test.txt&quot;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">,</span> mode<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    c.<span style="color: #202020;">put</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;get_test.txt&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;put_test.txt&quot;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">,</span> mode<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> catch <span style="color: #009900;">&#40;</span>Exception e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	    System.<span style="color: #202020;">out</span>.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	System.<span style="color: #202020;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">//end of action</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2008/using-sftp-with-loadrunner-java-vusers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

