Forum Discussion

MatthewBeste's avatar
MatthewBeste
Occasional Contributor
11 years ago

Is there a way to set the Run mode of a test case from Groov

Hi,
I have been digging around all day. I created a testcase that sends an email. I cam caling the test case druing the teardown script to send an email if the test passes or fails. I am doing this for every test. It appears that the testcase is not executing in the create isolated copy for each run mode. Does anyone know how to set this from groovy?

The script I am using is as follows

def testCase = testRunner.testCase.testSuite.project.testSuites['Modules'].testCases['SendEmail']
testCase.setPropertyValue("Subject", subject)
testCase.setPropertyValue("Body",body)
testCase.run(null, false)

3 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Is it just for your trials to send an email after each test case? Inbox might be flodded if tests are more.

    What i had understand is that testRunner is not being identified in setup / tear down script, may be i was also missing some piece of information how to get that working.

    May be you can see if this links helps you viewtopic.php?t=7627
  • MatthewBeste's avatar
    MatthewBeste
    Occasional Contributor
    The issue isn't that the script above doesn't work it does. I am running the tests in parallel and when the test case runs it appears to not be running in a thread safe more. I am getting duplicate emails from some tests and none from others. I think that what is happening is one test case is calling it and another is changing the parameters before the email is sent.