shankar_r
8 years agoCommunity Hero
Running a a function with parameter in Command line
From Smartbear help document:
The following command runs TestExecute, loads the specified project suite (MySuite.pjs) and tells TestExecute to run the Main script routine located in the Unit1 un...
- 8 years ago
So, Instead of calling function with parameter in Command line. I changed my aspect to get it done my requirement.
Here is the function which i used and it's working fine.
function InitiateExecution() { var count_CL_Parameters = BuiltIn.ParamCount(); var static_String_TC_NameAndEnv = "TestCaseName="; var currentTestCasenameAndEnv = "",arr_TC_Parameter = null; try { if(count_CL_Parameters > 3)//This part is for running from Test Complete/Execute Commandline { for(var a = 0 ; a <= count_CL_Parameters ; a++) { if(aqString.Find(BuiltIn.ParamStr(a),static_String_TC_NameAndEnv,0,true) != -1) { currentTestCasenameAndEnv = BuiltIn.ParamStr(a); arr_TC_Parameter = currentTestCasenameAndEnv.split("="); if((arr_TC_Parameter != null) && (arr_TC_Parameter.length == 2)) { //CL_TestCaseName, CL_Environment are global variables CL_TestCaseName = GetCellValue.getNameFromValue(arr_TC_Parameter[1]); CL_Environment = GetCellValue.getCountFromValue(arr_TC_Parameter[1]); isCommandLine = true; driverscript(); break; } else { throw "TestCaseName not found" } } } } else//This part is for running from Test Complete/Execute manually { isCommandLine = false; driverscript(); } } catch(ex) { ShowMessage("Error Occured: \n Parameters are missing : Format should be <Test Compelte/Execute Path> <Project Suite path> /r /e [TestCaseName=<value>[EnvironmentName]] \n Or Unkown error : " + ex.stack); } }
It is may not be understandable since this function is part of Customized Data-driven framework which we are having in place.