Forum Discussion

nmrao's avatar
nmrao
Champion Level 3
3 years ago

Is there way to find if the test is invoked from command line or from UI

Hello,

 

Trying a different solution in relation to the following thread

https://community.smartbear.com/t5/API-Functional-Security-Testing/Centralizing-the-custom-properties-defined-for-Environments-Want/m-p/218703#M49123

 

Here, using Load Script at Project level.

Reading some arguments from java system properties in the solution.

 

def setArugmentsFromCommandLine = { arguments.keySet().each { arguments[it] = System.properties[it] } }

 

 

This is OK if test are executed from command line.

But for  those using UI, there is problem as users neither they  invoke the UI tool with system arguments, nor they set values for these properties.

 

In order to handle the case, need to know in the script of Load Script whether tests invoked from UI or not. So, it can be handled conditionally.

 

Any help is appreciated!

1 Reply

  • nmrao's avatar
    nmrao
    Champion Level 3
    It is easy to pass the java system properties for some one who is executing from command line. So thought of the solution in this line.

    Even though one can identify if it is run from command line or not in the Load Script, there is no elegant way for the user in UI mode to set the java system properties unless one is hands on the scripting / coding and to the solution i was trying.
    Used project properties approach, so that UI users can set the values for project properties easily and command line users as well.

    But still the answer to this question is interesting to me.