Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

fetch test case name by Groovy script

Options
UK_
UK_ Posts: 22

I had 2 questions :
1. How to fetch test response by groovy script.
2. How to get test case name by some runtime script using groovy

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,232 ✭✭✭
    edited November 2018
    Options

    How to fetch test response by groovy script

    You can chain an Extension Tool to the Response output of your test. Your script should contain a method with two arguments. The first argument to the method in your script will be the response message.

    How to get test case name by some runtime script using groovy

    The second argument to the method in your script is an object of type com.parasoft.api.ScriptingContext. You can call getContextName() on that ScriptingContext object to get the name of the tool running your script. If you need to get the name of the parent tool then you can call getParentContext() on the ScriptingContext object then call getContextName() on that parent context.

    Groovy Example:

    import com.parasoft.api.*
    
    void test(Object input, ScriptingContext context) {
        Application.showMessage(input.toString())
        Application.showMessage(context.getParentContext().getContextName())
    }
    

    Test name and execution detail, including test traffic, can also be saved after test execution has completed in a SOAtest XML report file. So, you can also consider running a script outside of SOAtest which parses the XML report to extract whatever specific information you desire about the test run.