command-linerft

How do I identify if Rational Functional Tester is being run from command line?


I'm changing a RFT recorded test to run from command line. It is running fine, but the original tests open some dialog boxes. I don't want to make big changes to the original code, since it has been developed by others in my team.

I'd like to put a test in the java code and just open the dialog box if is being run from the modified eclipse IDE. What should I test?


Solution

  • There is no explicit API that I am aware of that we can use to determine if launched from IDE /CLI. But we could simply do this:

    In the IDE, Window->Preferences->Java->Installed JRE , Select the default JRE that is usually the jdk bundled with RFT. Click Edit and we can add in Default VM arguments -Didelaunch=true

    Then in the script where you want to check if the launch is from ide we can use

    if(Boolean.getBoolean("idelaunch"))
        {
            //do something for ide execution
        }
    

    The above would be true when script is launched from the IDE. If you run from the CLI then it would be false as it is not defined but anyways you could set it to false explicitly as

    java -Didelaunch=false  -jar rational_ft.jar -datastore <datastore> -playback <scriptname>
    

    Or we could set this variable in the Command-line say -Dclilaunch=true, as follows

    java -Dclilaunch=true  -jar rational_ft.jar -datastore <datastore> -playback <scriptname>
    

    and check it as follows

    if(Boolean.getBoolean("clilaunch"))
        {
            //do something for cmdline execution.
        }
    

    in the Script to determine if launched from Commandline