Forum Discussion

vijperum's avatar
vijperum
Occasional Contributor
9 years ago

Setting dependency to a Test Case.

Can we set a Test Case from another test suite to the test case in one.

4 Replies

  • Tylhadras's avatar
    Tylhadras
    SmartBear Alumni (Retired)

    Hey vijperum. What exactly are you trying to accomplish? Do you want to run a Test Case from another test suite as a Test Step in your current Test Case? Please describe what you want to do a bit more in detail please.

     

    Regards

    Gustav Lundström

    • vijperum's avatar
      vijperum
      Occasional Contributor

      Assuming I have a TestSuite A is run first via test runner which has a Test Case whose test step is  having a dependency in  another Test Suite B that is not yet run. I would like to set that run this test case after the dependent Test Case is run. Like we do in the ant task where we set the dependency.

  • Tylhadras's avatar
    Tylhadras
    SmartBear Alumni (Retired)

    What you'll need to do is create a Groovy Script Test Step that runs the dependent Test Case.

     

    I've created an example:

     

     

    import com.eviware.soapui.support.types.StringToObjectMap
    
    def externalTestCase = testRunner.testCase.testSuite.project.getTestSuiteByName("Test account creation").getTestCaseByName("accountcreation TestCase")
    
    return externalTestCase.run(new StringToObjectMap(), false))

    Where the new StringToObjectMap() can be replaces with a map of properties for the dependent Test Case and the second argument (true/false) says wheter to run the external Test Case asynchronously.

     

    • vijperum's avatar
      vijperum
      Occasional Contributor

      Thank you will try this and let you know