galen
galen copied to clipboard
Issue with switch - case in .js file
Hi Ivan,
I found it very hard to implement the switch-case statement in our .js file. In below statement
strAppName = "app1";
switch(strAppName){
case "app1":
System.out.println("App1");
break;
case "app2":
System.out.println("app2");
break;
default:
System.out.println(" Warning: Invalid strAppName - '" + strAppName + "'. Please add data in globalTestData.js");
break;
}
`
Here, the default block is always getting executed.
I tried even converting the strAppName to java.lang.String format in our galen js file, it execute only default. I tried executing this block of code in browser console, it worked.
Would you be able to guide here?
I also had one more switch-case statement inside each case. I am not sure if cascaded switch-case statement is the root cause of the failure. Has any one faced this issue?
Also what is the precedence of the language interpretation? Is JavaScript is favored over Java in our Galen Suite?