On 02/10/2008, sebb <[EMAIL PROTECTED]> wrote:
> On 02/10/2008, Mark24 <[EMAIL PROTECTED]> wrote:
>  >
>  >  My untrained eye cannot fault my test. Can anyone see where I've done
>  >  something wrong please?
>  >
>  >  Expected result: The console shows:
>  >  In First Thread: 417E9AFE-1690-DD11-8B26-005056C00008
>  >  In Second Thread: 417E9AFE-1690-DD11-8B26-005056C00008
>  >  In Second Thread Login: 417E9AFE-1690-DD11-8B26-005056C00008
>  >
>  >  Actual result:
>  >  In First Thread: 417E9AFE-1690-DD11-8B26-005056C00008
>  >
>  >  http://www.nabble.com/file/p19772782/11%2Bconsole%2Bresults.png
>  >  Above is the results seen in the console window from running the test 
> (refer
>  >  to the last line in the screenshot; the previous 2 lines are experimental
>  >  runs with other print() statements in the BeanShell code)
>  >
>  >  Note that the log file reports that there is an error at 
> print(bsh.args[0])
>
>
> And which thread group is running when this occurs? Line no, col no?
>
>  There must be an occurrence of print(bsh.args[0]) somewhere in the
>  test plan; search the JMX file for it.
>
>  This is presumably why Thread Group 2 does not show any output.
>
>
>  >  I expect property "securityid" to return the same value in Thread 1 as in
>  >  Thread 2 but clearly it doesn't.
>
>
> How do you know that?
>
>  There is no output showing the value, which is probably because of the
>  error in the log.
>
>  Looks to me like Thread Group 2 does not produce any output.
>
>  Instead of using BeanShell to show values, try using the Debug Sampler
>  - that's what it is for.
>
>
>  >  http://www.nabble.com/file/p19772782/1%2BTest.png
>  >  Above is the test
>  >
>  >  http://www.nabble.com/file/p19772782/2%2BTestPlan.png
>  >  Above is the test plan
>  >
>  >  http://www.nabble.com/file/p19772782/3%2BThread%2B1.png
>  >  Above is Thread 1
>
>
> Thread Group 1
>
>
>  >  http://www.nabble.com/file/p19772782/4%2BLogin%2528%2529.png
>  >  Above is Login()
>  >
>  >  http://www.nabble.com/file/p19772782/5%2BGet%2BtheID.png
>  >  Above is Get theID
>  >
>  >  
> http://www.nabble.com/file/p19772782/6%2BSet%2Band%2Bprint%2Bsecurityid.png
>  >  Above Set and print securityid
>
>
> Print statement would be safer as
>
>  print("In First Thread Group: ${__P(securityid)}");
>
>  Your statement only works because the property is enclosed in quotes.
>

Thanks for the test plan sent privately.

The setProperty statement below is wrong:

${__setProperty(securityid,bsh.args[0])};

Variables and functions are evaluated before they are passed to
BeanShell, so the script sees the return value from the function -
which is the empty string - and the property is set to "bsh.args[0]".

This is what causes the error in the print statements in the second
thread group.

Print works OK in the first thread group, because the print statement
resolves to:

print("In First Thread: " + bsh.args[0]);

bsh.args[0] is defined there; it is null in the second thread group,
which causes the error.
[You can see this by providing parameters in Thread Group 2]

This problem was quite easy to find using the Debug Sampler to show
the property values.

The simplest solution is to recode the setProperty as

${__setProperty(securityid,${theId}};

but this does not need BeanShell to execute - any sampler will do.

You also need to change the print statements in the scripts so that
any JMeter variable and function references are within quotes; only
BeanShell variables are valid outside the quotes.

The ${} references are replaced by their values *before* the script is
passed to BeanShell.

>  >  http://www.nabble.com/file/p19772782/7%2BThread%2B2.png
>  >  Above is Thread 2
>
>
> Thread Group 2
>
>
>  >  http://www.nabble.com/file/p19772782/8%2Bprint%2Bsecurityid.png
>  >  Above is print securityid
>
>
> See above.
>
>
>  >  http://www.nabble.com/file/p19772782/9%2BLogin%2528%2529.png
>  >  Above is Login()
>  >
>  >  
> http://www.nabble.com/file/p19772782/10%2Bprint%2Bsecurityid%2Bwithin%2BLogin%2528%2529.png
>  >  Above is print security within Login()
>  >
>
>
> Ditto.
>
>  It's impossible to debug the test fully from the screenshots.

In retrospect, that was wrong, but it's certainly easier with a script...

>  I will need to see the actual test plan. Just redact the sensitive
>  parts, and then send me a copy privately.
>
>  >
>  >
>  >
>  >
>  >  --
>
> >  View this message in context: 
> > http://www.nabble.com/how-do-I-pass-a-value-obtained-in-%22Thread-Group-1%22-%28with-%22XPath-Extractor%22-from-a-%22WebService%28SOAP%29-Request%22%29-to-%22Thread-Group-2%22-for-use-as-input-to-%22WebService%28SOAP%29-Request%22-tp19683794p19772782.html
>  >
>  > Sent from the JMeter - User mailing list archive at Nabble.com.
>  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >  For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to