I need to execute some parts of code in a individual test cases even the test case failed

There is a programming twist:

A Test Case is in effect an instance of Script class in Groovy language. A Groovy script can contain zero or more local Groovy methods . For example, the following Groovy script can be a valid Test Case with 3 methods:

def method1(String name) {
    println "Hello " + name + ", I am the first case"
}
def method2(String name) {
    println "How are you " + name + "?"
}
def method3(String name) {
    println "Goodbye, " + name
}

method1("Poo")
method2("Poo")
method3("Poo")

When you run this Test Case, you will see an output in the console:

Hello Poo, I am the first case
How are you Poo?
Goodbye Poo

You can let your single Test Case to contain as many methods as you like. You can code anything in each methods.