Jump to content
WAPT Forum
Sign in to follow this  
Guest cirej2000

Dynamic Numeric/String context variables

Recommended Posts

Guest cirej2000

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.

 

 

Share this post


Link to post
Share on other sites
Guest cirej2000

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.

Share this post


Link to post
Share on other sites
Guest cirej2000

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.

 

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Guest cirej2000
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.

<_< 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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest cirej2000
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:

 

Ok, thanks for the info Sergei!

 

 

 

Share this post


Link to post
Share on other sites
Guest HUman

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...