Skip to content

Instantly share code, notes, and snippets.

@miceno
Created February 13, 2011 11:12
Show Gist options
  • Select an option

  • Save miceno/824596 to your computer and use it in GitHub Desktop.

Select an option

Save miceno/824596 to your computer and use it in GitHub Desktop.
Groovy testing
class MyClass{
def myname
}
class TestCase{
TestCase(){ }
def testNonEmptyTask(){
def f = new MyClass()
def name = "miceno"
println "processing $name"
f.myname= name
assert f.myname == name
}
def testNullTask(){
def f = new MyClass()
def name = null
println "processing $name"
f.myname= name
assert f.myname == name
}
}
def t= new TestCase()
// Invoke all the test* methods
t.class.methods.findAll{
it.name.contains( 'test')
}.each{
println "Testing ${it.name}";
t.invokeMethod( it.name, null)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment