Jump to content


Dynamic Numeric/String context variables


  • Please log in to reply
10 replies to this topic

#1 Guest_cirej2000_*

Guest_cirej2000_*
  • Guests

Posted 06 April 2010 - 05:39 AM

Here's my latest dilemma:

I would like to track a certain number of actions initiated by my profile script; including successes and failures.

In order to do that, I would think that an Initial Variable would be the ideal way to do this. The initial variable would then be updated by javascript code depending on the outcome of an if them statement.

Assigning values to a variable using context.variable("<variableName>") works fine. However, the problem is that I have no way of creating an initial variable which only has the two purposes:


1. Store values globally.
2. Be able to update dynamically based on actions in a javascript block.


Right now, the Initial Variables can only be one of a certain number of variable types (static text, variable, ordered list, ...). With the static text, I could assign a text representation of a number to initial the variable. The number can be incremented during that session. However the next session will see the number go back to the default specified in the static text definition.

Variable must point to some existing variable or function. If no variable or function is specified; I get a NotANumber exception when I attempt to increment the the variable.


So I know that there are potential issues dealing with a multi-threaded application when using global variables. We now move into the realm of mutexes, monitors, semaphores or whatever type of blocking structure must be used to keep the global data protected from unexpected data states. However, it is a key component for most top line Load Generator tools.

This is again not a blocking feature from using WAPT Pro; but it does limit it in its ability to track events in a load script.

If I'm overlooking a way to do this in the current 2.0 beta build which I have, then apologies for taking up your time in reading this post.



#2 Guest_cirej2000_*

Guest_cirej2000_*
  • Guests

Posted 07 April 2010 - 06:23 PM

Clarification:

I've discovered that I CAN create a variable that doesn't need to have a formula assigned to it (which was one of my issues). That still doesn't apparently resolve the issue of the lack of the equivalent of static variables.

#3 Guest_cirej2000_*

Guest_cirej2000_*
  • Guests

Posted 07 April 2010 - 06:31 PM

Whoops! Posted that last one too soon.

What I was trying to express in that post was the fact that the entire premise for this thread is now invalidated. The fact is that there are definitely "dynamic" variables. They are assignable and modifiable throughout the scope of a session, if/then or while block. However, they lose their allocation outside of those blocks.

What I really need is a static variable or global (if you prefer that terminology). Something that would allow a variable to be assigned a value that remains allocated across the entirety of a load test would be excellent.

In OpenSTA there is the ability to define the scope of a variable at the Thread, Test and Script level (I'm sure that since load runner uses a full implementation of ANSI C as it's language, you can use global variables there as well). These scopes allow you to keep variables constant for a particular Virtual User (Thread), an entire load test (Test) or for a particular profile (Script). It is a very powerful construct which, I know, introduces a higher level of complexity to the usage of a load test tool. Indeed, in OpenSTA, there was the need to explicitly assign mutexes around critical areas of code in order to protect the integrity of those shared variables. So it introduced the whole factor of "it's there, but if you use it without understanding the concepts...you'll wish you never knew it existed!".

However, for those people who understand a little something somethin about multi-threading (and honestly, what load test engineer shouldn't at least aspire to understand these concepts?) it's a powerful tool.



#4 Sergei Leonov

Sergei Leonov

    Advanced Member

  • Administrators
  • PipPipPip
  • 662 posts

Posted 09 April 2010 - 09:28 AM

Now you can make a global variable only via JavaScript, a file and a manual synchronization.
Possibly we will add global variables in the future versions.
Sergei Leonov
WAPT Project Manager
SoftLogica LLC

Office: +7-383-335-6692
Toll-free: 1-888-364-6797 (for US only)
Time zone GMT +6, EST +11
E-mail: support@loadtestingtool.com
http://www.loadtestingtool.com

#5 Guest_cirej2000_*

Guest_cirej2000_*
  • Guests

Posted 09 April 2010 - 03:23 PM

QUOTE (Sergei Leonov @ Apr 9 2010, 02:28 AM) <{POST_SNAPBACK}>
Now you can make a global variable only via JavaScript, a file and a manual synchronization.
Possibly we will add global variables in the future versions.

dry.gif Yuck!! That stinks!

Thank heavens for the javascript, though. Though I assume the synchronization would be limited to each load generator with the javascript, correct? I'll look into trying that solution down the road.

But yes, if you guys could investigate the global variable solution, that would be very, very helpful.

Thank you, Sergei.

#6 Sergei Leonov

Sergei Leonov

    Advanced Member

  • Administrators
  • PipPipPip
  • 662 posts

Posted 10 April 2010 - 05:09 PM

QUOTE (cirej2000 @ Apr 9 2010, 10:23 PM) <{POST_SNAPBACK}>
Though I assume the synchronization would be limited to each load generator with the javascript, correct?


You have to lock a file each time when use it. Open the file exclusively. Others will wait while one Load Agent unlock it.
Sergei Leonov
WAPT Project Manager
SoftLogica LLC

Office: +7-383-335-6692
Toll-free: 1-888-364-6797 (for US only)
Time zone GMT +6, EST +11
E-mail: support@loadtestingtool.com
http://www.loadtestingtool.com

#7 Guest_cirej2000_*

Guest_cirej2000_*
  • Guests

Posted 12 April 2010 - 02:50 AM

QUOTE (Sergei Leonov @ Apr 10 2010, 10:09 AM) <{POST_SNAPBACK}>
You have to lock a file each time when use it. Open the file exclusively. Others will wait while one Load Agent unlock it.

Working on the weekend! blink.gif

Ok, thanks for the info Sergei!




#8 Guest_HUman_*

Guest_HUman_*
  • Guests

Posted 30 September 2011 - 07:29 AM

hello,

I have a problem that needs solving :)
I have a two variables date from and date to. The bandwith between this two variables is limited to 3 months.
So let say that i get in to the variable date from some random date for instance 2.2.2011(random from a list).
So my question is how do I go from that date to less than 3 months in the future for instance date from is 2.2.2011 and date to will be 24.4.2011?

#9 Sergei Leonov

Sergei Leonov

    Advanced Member

  • Administrators
  • PipPipPip
  • 662 posts

Posted 30 September 2011 - 10:34 AM

I think Java Script is the better way to solve this problem.
Sergei Leonov
WAPT Project Manager
SoftLogica LLC

Office: +7-383-335-6692
Toll-free: 1-888-364-6797 (for US only)
Time zone GMT +6, EST +11
E-mail: support@loadtestingtool.com
http://www.loadtestingtool.com

#10 Guest_HUman_*

Guest_HUman_*
  • Guests

Posted 30 September 2011 - 11:25 AM

How do i insert JavaScript code insted of this variable?

#11 Sergei Leonov

Sergei Leonov

    Advanced Member

  • Administrators
  • PipPipPip
  • 662 posts

Posted 03 October 2011 - 07:05 AM

How do i insert JavaScript code insted of this variable?


You can use in Java Script context.variable("var_name") - gets/sets the value of the "var_name" variable.
Sergei Leonov
WAPT Project Manager
SoftLogica LLC

Office: +7-383-335-6692
Toll-free: 1-888-364-6797 (for US only)
Time zone GMT +6, EST +11
E-mail: support@loadtestingtool.com
http://www.loadtestingtool.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users