What's the difference between "Context" and "TestRunner" in SOAPUI?

When writing groovy in SOAPUI we use context several times and sometimes we use TestRunner.

Need help to understand the difference.

+3


source to share


1 answer


From the documentation :



  • testRunner is a TestCaseRunner object, which is the entry point to the soapUI API for accessing project items, results, etc. TestRunner is an object that actually executes TestCases by looping through TestStep in TestCase and executing them. It provides methods related to test execution and the underlying object model (via the testCase property). General use of the script:

    • using testRunner.testCase to get a containing TestCase from which all other objects in the project are accessible and manipulated.
    • using testRunner.fail (...) (or testRunner.cancel) to abort the current test table when an error occurs.
    • using testRunner.gotoStepByName (...) or testRunning.runTestStepByName (...) to postpone execution to a different step than the one after Script TestStep in TestCase (see ....)
  • context is a TestCaseRunContext object containing the context of the property. The main use for this is to store values ​​that can be used in subsequent tests or related scripts. for example

    context.myProperty = "Hello"

    will create a property named "myProperty" in the context and assign this string value "Hello". In the following script, you can access this with

    log.info (context.myProperty)

+8


source







All Articles