Forum Discussion

davebeattie's avatar
davebeattie
New Contributor
5 years ago

How to use external groovy script to save code repetition in setup/teardown scrips

Hi all,   Am new to ReadyAPI and just trying to get head around groovy scripting.    I have a lot of duplication in my test suites - mostly on setup/tear down methods and would like to be able to...
  • giovanni_favara's avatar
    5 years ago

    Hi davebeattie ,

    I think it's worth doing a script, your script is too simple for that. It consists mainly of variable declarations. Have you considered the possibility to reuse a test case in another test case? In ReadyAPI exist a test step that is called run test case. I have already used it, but not to read out a file.

     

    What I can also recommend to you is to deal with the events and event handlers. With events it is possible to manage code centrally and use it in many or all test cases.