RQM CMD Line Adapter

The RQM Command Line Adapter is the integration between RQM and a CMD-prompt which can start an external test-tool.
IBM.com Jazz.net Documentation developerWorks
RQM - CMD Adapter RQM - Selenium Adapter RQM - Junit Adapter

Contents:

  1. Using
  2. Installation
  3. Other Resources

The command-line adapter is very handy when a high-level integration is not possible. For example this way the Cucumber integration is established.

Using

Figure: Identification of the CMD in the script.

Installation

The goAdapter.bat file to start the adapter.
The choice was made to place the Java definition in the command to be executed. That gives the option to use different java's in different cmd-executions.

echo off

set adapterName=CMD2
set projectName=My BDD (Quality Management)
set user=cmduser
set password=cmduser

title RQM ADAPTER: %adapterName% - %projectName%

rem Change to the CommandLineAdapter Directory...
cd RQMCommandLineAdapter
rem If you remove the Config2.ini file you remove also the UUID of the adapter. When restarted it will generate a new one, resulting in a new ID.
rem del Config2.ini
if not exist "jars.txt" (
 echo *** This should be in the RQMCommandLineAdapter directory
 goto end
)
call start.bat -repository https://fibula5.vanlint5.nl:9443/qm -user %user% -password %password% -adapterName %adapterName% -projectArea "%projectName%"

:end
echo Ending goAdapter
I missed the 'Area' text in the -projectArea tag, which gave the Error 3.

Check the Cucumber example to see how files can be returned via de CMD line adapter.

pass.cmd

There is no need to change the jars.txt file.

A successful test exits with a code of zero, a pass.cmd example:

cd C:\PRJ\CMD
echo Test Program started
set sec=60
echo Waiting for  %sec% seconds
call wait %sec%
echo Test Program ended
exit 0

fail.cmd

A failing test exits with a code different than zero, a fail.cmd example:

cd C:\PRJ\CMD
echo Test Program started
set sec=60
echo Waiting for  %sec% seconds
call wait %sec%
echo Test Program ended
exit 600

See quickpass.cmd for more return-codes.

quickpass.cmd

You can give various return-codes with the CMD prompt. This sample script does so. Check the documentation on "Customizing the command-line adapter">

Figure: Test Result of a suite with test cases referencing all to the quickpass.cmd.

cd C:\PRJ\CMD
echo Test Program started
set sec=1
echo Waiting for  %sec% seconds
call wait %sec%
echo Test Program ended

SET /A randValue=%RANDOM% * 100 / 32768
REM The lower 50% of the results will pass.
if %randValue% LEQ 50 GOTO :pass
echo FAIL
set /A lastDigit=%randValue:~-1%
set /A retc=4%lastDigit%
goto :oef

:pass
echo PASS
set retc=0
goto :oef

:oef
exit %retc%

wait.cmd

For forcing a %1 of seconds I use the following script. It has the random in it which enables parallel execution.

echo Waiting for %1
SET /A number=%RANDOM%
set file=%number%file.txt
ping -n %1 -w 1000 localhost > %file%
del %file%

Other Resources

  1. Integrating your test tools with IBM Rational Quality Manager using the command-line adapter
  2. goAdapter.bat
  3. Check the Cucumber-page for a sample usage.
  4. Rename Adapter type question
  5. Start/Stop services with CMD line RTVS-CLI