Forum Discussion

sabereshcp's avatar
sabereshcp
Contributor
16 years ago

Executing only one teststep in a testcase

Hi,

I wanted to know whether we can execute only a particular test step in a testcase using "Run Test case " test step.

Say for example i have two test cases in my testsuite named testcase1 and testcase2. Testcase2 contains 3 groovy script steps. I wanted to execute only a particular groovy script step in testcase2 depending upon my output from the soaprequest step in testcase1.

Whether this can be acheived by any groovy script or by the run testcase step.

Thanks,

Saberesh C P

6 Replies

  • iangfox1965's avatar
    iangfox1965
    Occasional Contributor
    Right-click on the test steps you don't want to run and select 'Disable Teststep'. To bring them back simply right-click and select 'Enable Teststep'. Hope that answers your question.
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    Since you only want to execute 1 of the scripts, sounds like it would be easier to combine the 3 into 1 Groovy step and wrap them with conditional logic to only execute the code wanted.
  • Hi ,

    Thanks for all  your reply.

    But I am calling the test case from another test case and i need to execute the test steps in the test case which is begin called in a alternative manner(one test step at a time) for each and every time I call it.Say for example I have 4 test steps in the test case which is being called I need to execute only step 1 at the first time the test case is called and step 2 when it is called second time.

    So, I just wanted to know whether using groovy script can we invoke only a particular test step in another test case by getting hold of the test case.


    Thanks in Advance,

    Saberesh C P
  • Hi,

    I am able to run the entire testcase using the following groovy script.

    def testCase = testRunner.testCase.testSuite.testCases["Add"]

    But , I wanted to execute only a particular test step from the Add test case.Can anyone let me know the groovy script for the same.


    Thanks in Advance,

    Saberesh C P
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    How about this?

    [tt:1ozmdqfp]testRunner.testCase.testSuite.getTestCaseByName("Add").getTestStepByName('Groovy Script 1').run(testRunner, context)[/tt:1ozmdqfp]
  • Hi McDonald,

    Thanks for your reply...It worked...

    Thanks,

    Saberesh C P