Forum Discussion

andrewlaser's avatar
andrewlaser
Occasional Contributor
7 years ago

BUG: Command-line param -P is not considered in Load Script

Version 5.4.0

I'm setting project property when executing from command line -Penvironment=overridden

See attached *.bat file

 

But the passed value is ignored in Load Script

It is considered only in test case

 

See global-groovy.log I'm printing the same property in Load Script and in test case, but the printed values are different.

 

soapUI project is attached as well.

5 Replies

  • JHunt's avatar
    JHunt
    Community Hero

    Can you use a TestSuite Setup Script instead of the Project load script?

     

    16:10:10,702 INFO  [log] Project Load Script: abc
    16:10:10,705 INFO  [SoapUITestCaseRunner] Setting project property [environment]
     to [def]
    16:10:10,706 INFO  [SoapUITestCaseRunner] Running SoapUI tests in project [Proje
    ct 1]
    16:10:10,707 INFO  [SoapUITestCaseRunner] Running Project [Project 1], runType =
     SEQUENTIAL
    16:10:10,729 INFO  [log] Setup Script: def
    
    16:10:10,733 INFO  [SoapUITestCaseRunner] Running SoapUI testcase [TestCase 1]
    16:10:10,762 INFO  [SoapUITestCaseRunner] running step [asd]
    16:10:10,786 INFO  [log] Groovy Script TestStep: def
    • andrewlaser's avatar
      andrewlaser
      Occasional Contributor

      As a workaround I added test suite "Precondtitions" with test case "Preconditions" containing Groovy script at the beginning of the test project

      def env = context.testCase.getProject().getPropertyValue("environment")

      ... using variable env

       

      It reads a correct parameter value.

       

      You suggestion may work, but it's just a workaround as well.

      I'd need to keep this test suite at the beginning of the project.

      • andrewlaser's avatar
        andrewlaser
        Occasional Contributor

        Any plans to fix this issue?

        With my (the only working) workaround it's impossible to run a particular test case from command line, because TestRunner Command-Line Arguments c/s :  accept only 1 test/suite name. And I need at least two names to run a particular test suite (Precondition test/suite + desired test/suite)

  • nmrao's avatar
    nmrao
    Champion Level 3

    Would you please try to change the contents of your batch file as below and give it a try?

     

    "C:\Program Files\SmartBear\SoapUI-5.4.0\bin\testrunner.bat" -Penvironment=overridden -f "C:\Temp\" -raj "C:\Temp\temp2.xml"
    • andrewlaser's avatar
      andrewlaser
      Occasional Contributor

      Suggested by you command line is invalid.

      Probably wrong parameters order.