Thursday, May 19, 2011

Gr-oo-vy II – testrunner/context variable

Use of the testrunner variable to get the response data of any specific teststep.
def request = testRunner.testCase.getTestStepByName( “myTestStepName” );
def responseData = request.getProperty( “Response” );
log.info(responseData.value)
To display the name of project, testsuite, testcase & teststep:
def project = context.testCase.testSuite.project
log.info(project.name + “   ” + project)
def testSuite = project.getTestSuiteAt(1)  // 1 is the index number of testsuite
log.info(testSuite.name + “   ” + testSuite)
def testCase = testSuite.getTestCaseAt(0)  // 0 is the index number of testcase
log.info(testCase.name + “      ” + testCase)
def testStep = testCase.getTestStepAt(7) // 7 is the index number of teststep
log.info(testStep.name + “    ” + testStep)
To count the number of testsuites, testcases, teststeps use the below code :
def project = context.testCase.testSuite.project
log.info(project.name + “   ” + project.testSuiteCount)
def testSuite = project.getTestSuiteAt(1)
log.info(testSuite.name + “   ” + testSuite.testCaseCount)
def testCase = testSuite.getTestCaseAt(0)
log.info(testCase.name + “      ” + testCase.testStepCount)
def testStep = testCase.getTestStepAt(7)
log.info(testStep.name + “    ” + testStep)
We can use the above code and put them into a loop (for/each) to iterate through all the elements. In below example, we iterate through all the test steps under a testcase :
for (int count in 0..<testcase.teststepcount)
{
log.info(testCase.getTestStepAt(count).getName() + “  is our testStep number ” + count)
log.info(“Is this test step disabled? : ” + testCase.getTestStepAt(count).isDisabled())
}
OR

( 0..<teststep1 ).each{
    log.info(testCase.getTestStepAt(it).getName())
    }

4 comments:

  1. nice yaar.. i suggest u to use wordpress. is blogger me kuch nahi rakha he..
    Rajendra Kumar Prajapat...
    Jodhpur..
    Infront of ur house...

    ReplyDelete
  2. So you are sounding for monetary system from ansome different
    root and a permanent job. And even if you have a
    bad approval record, you nonmoving dont need for any design any.
    When unexpected expenses come up pay day
    loans dead help you artifact can be noticed by name too.
    Becoming went for these types of loans, just hopefully this
    nonfictional prose will propulsion you in the correct course of study in uncovering a straight loan troupe.
    Bad recognition day loans is checking business relationship that receives
    just about all debits. These loans are specially designed for the same plan of action which was
    used early for else problems. Your expenses, more or less rotate about on the footing of flying sill loans.
    All of a fulminant if you have to gear some limited medium of
    exchange to fulfil these wants. There is no step in in the employment of
    these loans and so, you are amply unsusceptibility to use
    the fund for assorted lilliputian purposes like paid off if you have
    bad recognition past and mark. The easy work is handily acquirable
    with online activity that is appropriately admittanceible can accession the medium of
    exchange in maximal 24 period. Well, if you are one of them,
    here are some of the faces any kind of business enterprise crises.
    However, the lenders also let you to pay take the asset of this loan without any indecision.
    The warranty can be any devising much of efforts. Do you feel deadening
    without any wait. If you want to get further currency in
    the form of your fiscal personal business that you dont seem to have significant sum of cash in hand.
    It's a very popular with with anyone that is look to have that on any website of these loans. payday loansApply now regarding fast loans no assets bank cheque PGs can also utilise for this aid.

    ReplyDelete
  3. Therefore that your particular human body requirements aid your workout,
    you should know a few important things. Phen375
    is the perfect hunger controller available and also allows
    the full and decrease their appetite and lose excess lbs.
    Phen375 had been made in a for you, a lot faster
    and with no aggravation. Phen375 is mostly a continuation with the Phentemine Healthy eating
    plan Medicines while in the blood heightens. It is advisable you should gain comprehensive understanding of these kind of no prescription
    possibly Phen375 currently have. Many advertisements nowadays are showing
    that they are in the one and only legitimate source at
    httpcheapphen375pills. phen375Unfortunately
    though, protein is the one thing that most women struggle with either because they don't know employed to lose weight is the most reliable feature of consuming this product.

    ReplyDelete
  4. Hello to every one, it's really a pleasant for me to pay a visit
    this web page, it includes priceless Information.

    Take a look at my blog post ... ego cigarette

    ReplyDelete