SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    New Member
    Join Date
    Jan 2016
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Question Unable to execute a logical condition from a loaded variable

    Issue in executing a switch or if-else statement. Here what I am doing.
    1. Pulled the property file (external file) and load it to JMETER.
    2. In the BeanShell Preprocessor I coded this


    Code:
    	if(vars.get("PUB").equals("Y")) {
    		vars.put("IP_API",vars.get("IP_PUB"));
    			if (vars.get("A").equals("2")){
    					vars.put("RES_PATH",vars.get("A2")+vars.get("PUB_PATH"));}
    				else {
    					vars.put("RES_PATH",vars.get("A3")+vars.get("PUB_PATH"));}
    	} else {
    			vars.put("RES_PATH",vars.get("PRIV_PATH"));
    	}
    However, when i run my script it doesn't pulled Res_path variable in the HTTP Request element under path.

    Note that Pub, A, A2 and A3 are from the property file. Appreciate your response.

  2. #2
    Member
    Join Date
    Oct 2013
    Posts
    112
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    In order to access a JMeter Property (from .properties file or passed via command-line) you need to to use "props", not "vars".

    Also add some debug logging via "log.info("your message here");" to get variables and properties values printed to jmeter.log file.

    See How to Use BeanShell: JMeter's Favorite Built-in Component guide for some Beanshell tips and tricks in regards to JMeter context.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 08:26 PM.

Copyright BetaSoft Inc.