Forum Discussion

Joeri's avatar
Joeri
Regular Visitor
6 years ago

testRunner / context / log not available (No such property) after running other testcase

I have a problem where testRunner / context / log are not available anymore in the script after running another testcase in this script (error e.g. groovy.lang.MissingPropertyException: No such property: context for class: Script1).

 

Since the situation is quite complicated, I have made a project illustrating the problem if you run the testcase 'start'. Can you help me out what is the problem here? I'm using SoapUI-5.4.0.

3 Replies

  • KonstantinosLps's avatar
    KonstantinosLps
    Occasional Contributor

    Hi joeri,

    there is nothing really compicated with your script at first. I usually set a context property using this

    context.setProperty("value","value")

    after that you can access this property by using

    context.value

    Have you tried this approach?

     

    Thank you

    -Konstantinos

  • nmrao's avatar
    nmrao
    Champion Level 3
    Hmm.. Little tricky the way you designed the tests.

    Test are being called in cyclic fashion and once you call the test case from "handler", it is losing the "context". Here do you need to call them in the same manner?

    The thumb rule is that, each and every test case is independent.

    May be you need to reconsider the test case design so that they run independently. Or club them in a single testcase otherwise.
  • Hi Joeri,

     

    Yes i am agreed with nmrao, the way you have created your framework is quite tricky because when you run in this cyclic way it just losses the Context.

     

    So the main problem which i found is with context.testvar="5" in your handle groovy script.

     

    So reconsider about the design of your framework.