Forum Discussion

djangofan's avatar
djangofan
Contributor
13 years ago

Why is UnrecognizedOptionException fatal to the test suite?

Why is UnrecognizedOptionException fatal to the test suite? If I pass a valid "PRO" option to the SoapUI community edition testrunner.bat script, in my opinion, it should gracefully fail instead of being fatal to the test suite.

I would understand the exception if you passed a non-existent option or bad syntax in a option but if you are passing a well-formed but simply unsupported option, then it should gracefully fail with a "-R option requires pro version" message instead of blowing up my test suite.

I bought SoapUI PRO for my Jenkins server but I cannot afford 2 licenses and so I run SoapUI community on my development machine and so my -R and -F options crash my test in my dev environment. It is really inconvenient to toggle the options when I have code checked into source control. So, if this isn't fixed, I have to spend valuable time trying to come up with a hack of some kind (in my Jenkins .bat script) to include the options only when the PRO version is detected.

Running...
soapUI 4.5.2 TestCase Runner
2013-06-12 09:50:27,827 [main] ERROR com.eviware.soapui.tools.SoapUITestCaseRunner - org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: -R

2013-06-12 09:50:27,827 [main] ERROR com.eviware.soapui.SoapUI - An error occured [Unrecognized option: -R], see error log for details
2013-06-12 09:50:27,828 [main] ERROR soapui.errorlog - org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: -R
org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: -R
at org.apache.commons.cli.Parser.processOption(Parser.java:253)
at org.apache.commons.cli.Parser.parse(Parser.java:170)
at org.apache.commons.cli.Parser.parse(Parser.java:114)
at com.eviware.soapui.tools.AbstractSoapUIRunner.initFromCommandLine(AbstractSoapUIRunner.java:109)
at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:87)
at com.eviware.soapui.tools.SoapUITestCaseRunner.main(SoapUITestCaseRunner.java:115)

2 Replies

  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    The open source testrunner implementation is not aware that a pro runner exists nor do not know anything about the options available in the pro runner, so it cannot work as you expect.

    Regarding to what you explain about your dev environment, you may try this.
    I know that the pro testrunner does not require license to run through the command line, so you could install soapui pro using the archive package (ie not a package with a native installer). Then only use this soapui pro instance for launching tests with the command line testrunner.
    I don't know if this respect the soapui pro license agreement (see this post for instance: viewtopic.php?f=1&t=19204)
  • I really appreciate the answer but I see no reason why the Open Source version of SoapUI testrunner cannot be enhanced to gracefully handle these 4 or 5 options. I can easily decide whether or not to pass the args to testrunner.bat by using a code snippet like this, but if I do, the open source version shouldn't choke:

    ECHO Checking if ^"%SOAPUI_HOME%soapui-pro-4.5.2.jar^" exists.
    IF EXIST "%SOAPUI_HOME%soapui-pro-4.5.2.jar" (
    SET "PRO_ARGS=-F"HTML" -R"%REPORT_NAME%""
    ) ELSE (
    SET PRO_ARGS=
    )


    Then,

    SET "ARGUMENTS=-s"My Test Suite" -c"My Test 1" -r -a -j"
    SET "ARGUMENTS=%ARGUMENTS% -h"%HOSTPORT%" -f"junit-results" %PRO_ARGS% MyProject.xml"
    CALL "%SOAPUI_HOME%testrunner.bat" %ARGUMENTS%