Forum Discussion
Manoj
13 years agoContributor
Hi ,
I have successfully created the dynamic assertion using the above code.
But when I run it from the test case, it fails for some of the steps and passed for some of them. However individually when i run it passed for individual values.
I have the following code...
for(i in 1..30 )
{
log.info ( "this is in IF i " + i)
def subscriberListValue =holder["//Row[$i]/SUBSCRIBER_ID[1]"]
def props1 = testRunner.testCase.getTestStepByName( "Count_GetDistinct_MembersforEach_SubscriberID" ) // This is my JDBC Step where I am adding the assertion //
def assertionsList = testRunner.getTestCase().getTestStepByName("Count_GetDistinct_MembersforEach_SubscriberID").getAssertionList()
for( e in assertionsList){
testRunner.getTestCase().getTestStepByName("Count_GetDistinct_MembersforEach_SubscriberID").removeAssertion(e)
}
def assertionName = "AssertXPATH" + "$i"
def assertText = testRunner.getTestCase().getTestStepByName("Properties").getPropertyValue("assert_Text") // This is "count(//MEMBER_ID)"
def assertion = testRunner.getTestCase().getTestStepByName("Count_GetDistinct_MembersforEach_SubscriberID").addAssertion("XPath Match")
println " \n\n ########## Assertion Name " + assertionName
assertion.name = assertionName
assertion.path = assertText
assertion.expectedContent = noOfMember // This is the number of members from a XML file and it changes according to my XPATH each time
testRunner.runTestStepByName("Count_GetDistinct_MembersforEach_SubscriberID")
}
The strange thing is i can find some of the steps passed and some failed when run. However it passed when run individually. Please find the attached screen-shot.
Please let me know if anything i am doing wrong
Thanks,
Manoj
I have successfully created the dynamic assertion using the above code.
But when I run it from the test case, it fails for some of the steps and passed for some of them. However individually when i run it passed for individual values.
I have the following code...
for(i in 1..30 )
{
log.info ( "this is in IF i " + i)
def subscriberListValue =holder["//Row[$i]/SUBSCRIBER_ID[1]"]
def props1 = testRunner.testCase.getTestStepByName( "Count_GetDistinct_MembersforEach_SubscriberID" ) // This is my JDBC Step where I am adding the assertion //
def assertionsList = testRunner.getTestCase().getTestStepByName("Count_GetDistinct_MembersforEach_SubscriberID").getAssertionList()
for( e in assertionsList){
testRunner.getTestCase().getTestStepByName("Count_GetDistinct_MembersforEach_SubscriberID").removeAssertion(e)
}
def assertionName = "AssertXPATH" + "$i"
def assertText = testRunner.getTestCase().getTestStepByName("Properties").getPropertyValue("assert_Text") // This is "count(//MEMBER_ID)"
def assertion = testRunner.getTestCase().getTestStepByName("Count_GetDistinct_MembersforEach_SubscriberID").addAssertion("XPath Match")
println " \n\n ########## Assertion Name " + assertionName
assertion.name = assertionName
assertion.path = assertText
assertion.expectedContent = noOfMember // This is the number of members from a XML file and it changes according to my XPATH each time
testRunner.runTestStepByName("Count_GetDistinct_MembersforEach_SubscriberID")
}
The strange thing is i can find some of the steps passed and some failed when run. However it passed when run individually. Please find the attached screen-shot.
Please let me know if anything i am doing wrong
Thanks,
Manoj
Related Content
- 12 years ago
- 3 years ago
Recent Discussions
- 2 days ago