Forum Discussion

FredrikWiden's avatar
FredrikWiden
New Contributor
10 years ago

Removing test suites and test cases in groovy

Hello!

I was recently handed a little project to generate some unit tests in SoapUI automatically for REST requests. We want to do this automatically since the services beeing tested can be called on many different levels which means there will be alot of test cases needed where alot of them will contain more or less the same assertions etc.

Now I think I have/can figure out most of this on my own.
But as a first step I would like to "clean up" any old test suites and test cases that have previously been generated in case there have been changes to the services beeing tested. This is likely to happen as they are still under development. Can this be done? Can you remove test suites and test cases in a groovy script?
I have been trying to google removing test cases and test suites using groovy for a few hours now and can't find anything except removing listeners or properties.
I could try to edit the existing ones but some of them might not be needed anymore and I'd like to avoid having manual removal steps if possible.

In case it makes a difference, my workplace doesn't run SoapUI Pro (sadly).

4 Replies

  • Thanks for the quick reply.

    We're using WADL but I think I've pretty much found how to update testcases using Groovy through detective work. This is what I mean when I talk about editing the test cases, poor choice of words by me. Although I'd be focusing more on updating the json request and assertions of the response rather than the definition itself.

    The thing is though that test cases or even entire test suites might become superfluous and if that happens I don't want to force the user to manually go through all the test cases. On top of that if I can't just remove them all at the beginning of script execution and create everything from scratch I'll have to implement checks if it exists from before then update otherwise create. It's possible but it would be easier to just remove all and create them from scratch.

    If it isn't possible in groovy to remove test cases and suites I'll probable try to move all the test cases to a Remove_this test suite and rename test suites to remove. Then create everything from scratch.
    I'm a tester and will soon have to work on automated tests for a database migration and a new system for calculating compensation for a benefit. I'm just helping some of our developers automate their unit tests while I wait for requirements to get done so I can start working with that. So I don't know how much time I'll have to do this.

    Also while I'm at it are there any good resources for groovy I should know about? I work alot with shell script, perl etc and sometimes even some java and for all of those google usually have the answers I seek. But I'm having a hard time finding good information about groovy.
  • nmrao's avatar
    nmrao
    Champion Level 3
    Ok.

    The one I sent earlier was to deal with frequent updates of wsdl, and it automatically not only update the definition, but also updates the existing test cases as well.
    Haven't played with WADL. I believe it must be mostly similar.

    You would get lot of things on the net for groovy as well.

    Below are the links soapui related groovy
    https://learnsoapui.wordpress.com/2011/ ... ps-soapui/
    http://www.soapui.org/Scripting-Propert ... ricks.html

    In general groovy site has lot of examples
    http://groovy.codehaus.org

    If you need change json, then below link might be helpful
    http://groovy-lang.org/json.html

    I would also recommend you to use some IDE with groovy (eclipse or intellij IDEA) for faster development.

    If you are familiar with Java, then you could procced do it in java itself, I believe there is no constraint.