Problem with passing exec.vars & built-ins to testMain().
RQM 4.0.1
Appears that passing of exec.vars and built-in variables on the java command line using -var argument that contain spaces are not properly parsed.
The following command line seen in the Adpater Console:
1:27:17 PM Executing RFT command /opt/IBM/SDP/jdk/jre/bin/java -Drqm.mode=true -Drqm.task="/tmp/RQMRFTTask8982188282226514612.xml" -jar /opt/IBM/SDP/FunctionalTester/bin/rational_ft.jar -datastore /tmp/RQMRFTProjects/82bba6a1/MA_ATI -rt.log_format xml -iterationcount -1 -rt.bring_up_logviewer false -execmode rqm -execmodeargs download -playback CLI -var "RQM_TESTCASE_EXECUTIONRECORD_NAME=snert-info;RQM_PROJECT_NAME=NETMAIL SECURE 5.1;RQM_TESTCASE_EXECUTIONRECORD_WEBID=1890;script=info.sh;RQM_TESTCASE_WEBID=1173;RQM_TESTCASE_NAME=snert-info;RQM_PROJECT_ALIAS=MPlusGuardian;RQM_TESTSCRIPT_WEBID=1180;RQM_TESTSCRIPT_NAME=Command Line Interface;testdir=/tmp"
At the top of testMain() I build a log string to report the arguments:
public void testMain(Object[] args)
{
StringBuilder s = new StringBuilder("args: ");
for (int i = 0; i < args.length; i++) {
s.append("{");
s.append(i);
s.append(": '");
s.append((String) args[i]);
s.append("'},");
}
s.setLength(s.length()-1);
logInfo(s.toString());
...
which is then reported in the RQM result output as:
args: {0: 'SECURE'},{1: '5.1;RQM_TESTCASE_EXECUTIONRECORD_WEBID=1890;script=info.sh;RQM_TESTCASE_WEBID=1173;RQM_TESTCASE_NAME=snert-info;RQM_PROJECT_ALIAS=MPlusGuardian;RQM_TESTSCRIPT_WEBID=1180;RQM_TESTSCRIPT_NAME=Command'},{2: 'Line'},{3: 'Interface;testdir=/tmp"'}
Its clear that the -var string is not properly splitting the string on the semi-colons into the Object[], but instead on the white space; probably would fail to handled a quoted literal semi-colon too.
Appears that passing of exec.vars and built-in variables on the java command line using -var argument that contain spaces are not properly parsed.
The following command line seen in the Adpater Console:
1:27:17 PM Executing RFT command /opt/IBM/SDP/jdk/jre/bin/java -Drqm.mode=true -Drqm.task="/tmp/RQMRFTTask8982188282226514612.xml" -jar /opt/IBM/SDP/FunctionalTester/bin/rational_ft.jar -datastore /tmp/RQMRFTProjects/82bba6a1/MA_ATI -rt.log_format xml -iterationcount -1 -rt.bring_up_logviewer false -execmode rqm -execmodeargs download -playback CLI -var "RQM_TESTCASE_EXECUTIONRECORD_NAME=snert-info;RQM_PROJECT_NAME=NETMAIL SECURE 5.1;RQM_TESTCASE_EXECUTIONRECORD_WEBID=1890;script=info.sh;RQM_TESTCASE_WEBID=1173;RQM_TESTCASE_NAME=snert-info;RQM_PROJECT_ALIAS=MPlusGuardian;RQM_TESTSCRIPT_WEBID=1180;RQM_TESTSCRIPT_NAME=Command Line Interface;testdir=/tmp"
At the top of testMain() I build a log string to report the arguments:
public void testMain(Object[] args)
{
StringBuilder s = new StringBuilder("args: ");
for (int i = 0; i < args.length; i++) {
s.append("{");
s.append(i);
s.append(": '");
s.append((String) args[i]);
s.append("'},");
}
s.setLength(s.length()-1);
logInfo(s.toString());
...
which is then reported in the RQM result output as:
args: {0: 'SECURE'},{1: '5.1;RQM_TESTCASE_EXECUTIONRECORD_WEBID=1890;script=info.sh;RQM_TESTCASE_WEBID=1173;RQM_TESTCASE_NAME=snert-info;RQM_PROJECT_ALIAS=MPlusGuardian;RQM_TESTSCRIPT_WEBID=1180;RQM_TESTSCRIPT_NAME=Command'},{2: 'Line'},{3: 'Interface;testdir=/tmp"'}
Its clear that the -var string is not properly splitting the string on the semi-colons into the Object[], but instead on the white space; probably would fail to handled a quoted literal semi-colon too.
One answer
Hi Anthony,
I think, the way you are parsing the execution variables inside "testMain" method is not correct. RFT suggest to do that like this -
public void testMain(Object[] args)
{
Iterator<IParameter> v = getVariablesManager().getAllInputParameters();
while(v.hasNext())
{
IParameter i = v.next();
logInfo("Param: " +i.getName() + " ParamValue: " + i.getValue());
}
}
Please check, if this helps, otherwise you might have to contact RFT support for this, as we cannot do anything from RQM side here.
Thanks,
Vijay
Comments
I have previously tried the method suggested and it fails to provide all the exec. vars and builts-ins when selected. This page...
http://pic.dhe.ibm.com/infocenter/rfthelp/v8r3/index.jsp?topic=%2Fcom.ibm.rational.test.ft.doc%2Ftopics%2Fr_handling_rqm_details.html
Says variables are available through testMain() too. And they would work fine if the parsing of the -vars argument actually worked correctly.