Jump to content


Problems with If/then statements using initial variables


  • Please log in to reply
6 replies to this topic

#1 Guest_cirej2000_*

Guest_cirej2000_*
  • Guests

Posted 30 March 2010 - 11:23 AM

I'm having a big problem with using initial variables.
First of all the initial variable I'm using is a ordered list from a file (this now works great, thanks!).
The goal of my script is to load the URL from a file and use that url in a request.

The script loads the next url in sequence with no problems.

Here's the problem:

My goal is to, based on the action type specified in the URL, go to a particular location in an if/then block.

So, if I load the url into a variable, $VAR(Fileurl), I want to be able to go to a certain block in the code

if $VAR(Fileurl) contains "hook"
GET_HookRequest
else if $VAR(Fileurl) contains "hover"
GET_HoverRequest
else if $VAR(Fileurl) contains "addtocart"
GET_CartRequest
else
GET_UnknownRequest
endif

There is no reliable processing in the if then else block.

I've tried to also use a javascript block to parse the value in the $VAR(Fileurl) and if the url has an index > 0 for one of the values (hook, hover, addtocart, unknown) then return a value (1,2,3,4) corresponding to that value. Then using the if them block:

if javascriptval=1
GET_HookRequest
else javascriptval=2
GET_HoverRequest
else javascriptval=3
GET_CartRequest
else
GET_UnknownRequest
endif


This does not work either.


Is this a problem with recognizing and using initial variables against other initial variables? Without a way to process the initial variables prior to the request blocks, it severely limits the usage of initial variables in decision making logic. This would limit making decisions based on a user/login, customer code, random value, etc.

Maybe I'm doing something wrong. I'm emailing the profile file for the javascript example above.

The non javascript example simply attempts to use the $Var(FileURL) value directly in the if/then statements.



#2 Sergei Leonov

Sergei Leonov

    Advanced Member

  • Administrators
  • PipPipPip
  • 662 posts

Posted 31 March 2010 - 09:57 AM

QUOTE (cirej2000 @ Mar 30 2010, 06:23 PM) <{POST_SNAPBACK}>
So, if I load the url into a variable, $VAR(Fileurl), I want to be able to go to a certain block in the code

if $VAR(Fileurl) contains "hook"
GET_HookRequest
else if $VAR(Fileurl) contains "hover"
GET_HoverRequest
else if $VAR(Fileurl) contains "addtocart"
GET_CartRequest
else
GET_UnknownRequest
endif

There is no reliable processing in the if then else block.


This is a bug. We are fixing 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

#3 Guest_cirej2000_*

Guest_cirej2000_*
  • Guests

Posted 31 March 2010 - 06:11 PM

QUOTE (Sergei Leonov @ Mar 31 2010, 01:57 AM) <{POST_SNAPBACK}>
This is a bug. We are fixing it.

Right on! You guys rock!

Thanks, Sergei.

#4 Sergei Leonov

Sergei Leonov

    Advanced Member

  • Administrators
  • PipPipPip
  • 662 posts

Posted 05 April 2010 - 11:03 AM

We have fixed the operator "if", but you have to recreate your profiles. You can download the new build from http://www.loadtesti.../WAPTPro2.0.zip
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 05 April 2010 - 03:07 PM

QUOTE (Sergei Leonov @ Apr 5 2010, 03:03 AM) <{POST_SNAPBACK}>
We have fixed the operator "if", but you have to recreate your profiles. You can download the new build from http://www.loadtesti.../WAPTPro2.0.zip

Great!

Will go ahead give this a try now.

Thanks again, Sergei.

#6 Guest_cirej2000_*

Guest_cirej2000_*
  • Guests

Posted 05 April 2010 - 03:42 PM

QUOTE (Sergei Leonov @ Apr 5 2010, 03:03 AM) <{POST_SNAPBACK}>
We have fixed the operator "if", but you have to recreate your profiles. You can download the new build from http://www.loadtesti.../WAPTPro2.0.zip

Excellent! Works great!

#7 Guest_cirej2000_*

Guest_cirej2000_*
  • Guests

Posted 05 April 2010 - 07:35 PM

Hi Sergei,

I've noticed a couple of issues with this release:

1) The Tools->Settings dialog will lose tabs as you click from one tab to the next. It goes from 7 to 2 tabs (with the general and Record tabs being the only ones remaining).

2) On the Initial Variables dialog, there is a problem with the ability to add a new variable. When I created my first two variables, I don't recall having a problem. And it seems as though if I attempt to create a variable right after starting WAPT Pro, things work fine. That being said, anytime during a session of WAPT Pro after the first attempt to create variable encounters a problem with the "Add" button on the "Add Variable" dialog. It does nothing after the first attempt during that run of WAPT Pro.

...

I now can no longer reproduce this issue after doing so a couple of times. I'll keep an eye open for the issue. Not sure if the settings menu was a side effect of the Initial Variable thing, vice-versa or if the two were unrelated. But they definitely occurred and were reproducible.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users