Eviware Forum

soapUI => soapUI => Topic started by: TomK on June 13, 2008, 04:40:09 pm



Title: Unit testing via soapUI and Groovy
Post by: TomK on June 13, 2008, 04:40:09 pm
I tried to run the following groovy Unit Test script in soapUI:

import groovy.util.GroovyTestCase

class MyTest extends GroovyTestCase {
    void testSomething() {
        assert 1 == 1
        assert 2 + 2 == 4 : "We're in trouble, arithmetic is broken"
    }
}

And I got the following casting error:
Fri Jun 13 16:26:57 BST 2008:ERROR:groovy.lang.GroovyRuntimeException: Failed to create Script instance for class: class MyTest. Reason: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'org.apache.log4j.Logger@1560b81' with class 'org.apache.log4j.Logger' to class 'java.util.logging.Logger'

Is this a bug or did I do something wrong with the script?

Thanks,

Tom


Title: Re: Unit testing via soapUI and Groovy
Post by: TomK on June 13, 2008, 04:55:50 pm
I think I managed to narrow it down to the extends instruction.


Title: Re: Unit testing via soapUI and Groovy
Post by: omatzura on June 15, 2008, 08:05:09 am
Hi!

exactly where are you entering this script? You probably don't need to wrap the assertions in a method, just enter

assert 1 == 1
assert 2 + 2 == 4 : "We're in trouble, arithmetic is broken"

regards!

/Ole
eviware.com


Title: Re: Unit testing via soapUI and Groovy
Post by: TomK on June 19, 2008, 01:06:36 pm
I was attempting to create Unit tests for the Java consumer so I have everything in one place.


Title: Re: Unit testing via soapUI and Groovy
Post by: omatzura on June 19, 2008, 06:57:23 pm
Hi,

ok.. but exactly where in soapUI are you entering this script? Can you attach a screenshot?

regards!

/Ole
eviware.com