roryLIT
11 years agoContributor
Creating a Groovy step using GroovyScript
I'm creating a groovy step in my testcase using the below groovyscript. However when I try to run the below script it brings up an error: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 5: unexpected char: '#' @ line 5, column 259. uniqueId = context.expand( '${#TestCase# ^ org.codehaus.groovy.syntax.SyntaxException: unexpected char: '#' @ line 5, column
def tc1 = testRunner.testCase.testSuite.project.testSuites["TestCaseScenarios"].testCases[tc];
gs = tc1.addTestStep( GroovyScriptStepFactory.GROOVY_TYPE, "rerun/cleanup" )
gs.properties["script"].value = 'def response = testRunner.testCase.testSteps["createClaim"].testRequest.response.contentAsString \nif (response.contains("Error processing query") == true) \n{ \ntestRunner.gotoStep(0) \n} \ndef uniqueId = context.expand( '${#TestCase#testCase}' )
Is there a way for it to recognise the # as I need to use it
Thanks!
def tc1 = testRunner.testCase.testSuite.project.testSuites["TestCaseScenarios"].testCases[tc];
gs = tc1.addTestStep( GroovyScriptStepFactory.GROOVY_TYPE, "rerun/cleanup" )
gs.properties["script"].value = 'def response = testRunner.testCase.testSteps["createClaim"].testRequest.response.contentAsString \nif (response.contains("Error processing query") == true) \n{ \ntestRunner.gotoStep(0) \n} \ndef uniqueId = context.expand( '${#TestCase#testCase}' )
Is there a way for it to recognise the # as I need to use it
Thanks!