How can i introduce a method call before every method in geb-spock specification file -


problem statement: how induct code automatically before start , end of test method in geb-spock specification file.

geb-spock not have related beforemethod or aftermethod gets executed before start/end of test method. feature provided testng tool. as, geb-spock uses junit internally , junit not have feature aswell, geb-spock not have facility aswell.

but, need work out on solution using geb-spock need induct code before start of test method , after completion of test method.

how can solve problem.

thanks, debasish

please follow below code understanding:

import spock.lang.specification class samplespockspec extends specification {     def setupspec(){           println "inside setupspec method"    }    def setup(){           println "inside setup method"    }    def "playactivity1"(){           println "iam activity 1"           given:           println "executing given stmt"            when:           println "executing when stmt"           then:           println "executing stmt"      }     def "playactivity2"(){           println "iam activity 2"           given:           println "executing given stmt"            when:           println "executing when stmt"           then:           println "executing stmt"    }    def "playactivity3"(){           println "iam activity 3"           given:           println "executing given stmt"            when:           println "executing when stmt"           then:           println "executing stmt"    }    def cleanup(){           println "inside clean method"    }    def cleanupspec(){           println "inside cleanupspec method"    }  }  **result:**  inside setupspec method inside setup method iam activity 1 executing given stmt executing when stmt executing stmt inside clean method inside setup method iam activity 2 executing given stmt executing when stmt executing stmt inside clean method inside setup method iam activity 3 executing given stmt executing when stmt executing stmt inside clean method inside cleanupspec method 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -