ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

How to determine string comparison in bean shell

book

Article ID: 133357

calendar_today

Updated On:

Products

CA Application Test

Issue/Introduction

Service virtualization: Need help to compare string and determine what the bean shell is doing.

Please help me to debug the beanshell script. I am attempting to do string comparison but am unable to troubleshoot


Cause

If a DevTest property is compared with a string and that property is not defined with any value in the script/testcase/project then the Beanshell code throw a script error.

Environment

Any released DevTest versions.

Component : CA Service Virtualization/Application Test

Resolution

Creating a property "TestEnvironment=PHOENIX" in project.config and then the if clause works when string comparison is done as below:


String Environment = testExec.getStateValue("TestEnvironment");

if(TestEnvironment.equals("PHOENIX")) 

{

....

...

}