Assertion of selective elements in a teststep
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Assertion of selective elements in a teststep
Hi,
I am using readyapi version 3.1.0 and I am trying to do the database testing using it
My test case looks like this
Iteration 1- csvdata file-Datasource step
step1
step2
step3
XPATH - [AC-1,EX-C-1]
XPATH - [AC-2,EX-C-2]
XPATH - [AC-3,EX-C-3]
step4
step5
step6
Datasource loop
Iteration 2- csvdata file-Datasource step
step1
step2
step3
XPATH - [AC-1,EX-C-4]
XPATH - [AC-2,EX-C-5]
XPATH - [AC-3,EX-C-6]
step4
step5
step6
Datasource loop
When i am looping my test case, all the steps are basically dbase calls only and output of step 3 is also from a table
and in the first iteration I am getting few fields & they are asserted using xpath assertion
But when i iterate it, input data for step3 changes and now I have 3 different fields in the same step(Step3) which i need to assert
It is like execution step3 is same, but it is displaying different output in the same column, because of my input data
And my requirement is, I need to assert all the elements using xpath match assertion
I am sure it can be achieved by Groovy script, wondering if in this flow I can be able to use readyapi existing components
Any help which leads to a direction is highly appreciated.
Please let me know, if it needs more clarification.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@anand1 : I think doing this by groovy script will easy your work as this is so dynamic. Even if you want to assert via pre existing feature of ReadyAPI then please share some response of Step-3.
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Thanks and Regards,
Himanshu Tayal
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @nmrao @HimanshuTayal
Below is the screenshot for the call that I am executing, and in both the screenshot, call is made to the same table, however the expected value that I am trying to assert is changing.
Screen1:
Screen2:
Let me know if that helps.
Thanks,
Anand
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Attach text of the response.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sure @nmrao
Sc2:
And the response output is
<Row rowNumber="1">
<_>[STUDENTOBJECTIVEASSESSMENTSCORErESULTS]</_>
<STUDENTOBJECTIVEASSESSMENTID>447023021</STUDENTOBJECTIVEASSESSMENTID>
<ASSESSMENTREPORTINGMETHODTYPEID>24</ASSESSMENTREPORTINGMETHODTYPEID>
<FORMATTEDRESULT>3611</FORMATTEDRESULT>
<SHORTDESCRIPTION>Scale score</SHORTDESCRIPTION>
<STUDENTOBJECTIVEASSESSMENTID>447023021</STUDENTOBJECTIVEASSESSMENTID>
<ASSESSMENTREPORTINGMETHODTYPEID>24</ASSESSMENTREPORTINGMETHODTYPEID>
<RESULT>3611</RESULT>
<RESULTDATATYPETYPEID>1</RESULTDATATYPETYPEID>
<EFFECTIVEFROMDATE>2020-03-11</EFFECTIVEFROMDATE>
<EFFECTIVETODATE/>
<CREATEDDATE>2020-03-11 09:05:58.353</CREATEDDATE>
Assertion is
//Results[1]/ResultSet[1]/Row[1]/FORMATTEDRESULT[1]
#Reading for Information Scaled Score
Next Iteration
<Row rowNumber="1">
<_>[STUDENTOBJECTIVEASSESSMENTSCORErESULTS]</_>
<STUDENTOBJECTIVEASSESSMENTID>447023021</STUDENTOBJECTIVEASSESSMENTID>
<ASSESSMENTREPORTINGMETHODTYPEID>24</ASSESSMENTREPORTINGMETHODTYPEID>
<FORMATTEDRESULT>3611</FORMATTEDRESULT>
<SHORTDESCRIPTION>Scale score</SHORTDESCRIPTION>
<STUDENTOBJECTIVEASSESSMENTID>447023021</STUDENTOBJECTIVEASSESSMENTID>
<ASSESSMENTREPORTINGMETHODTYPEID>24</ASSESSMENTREPORTINGMETHODTYPEID>
<RESULT>3611</RESULT>
<RESULTDATATYPETYPEID>1</RESULTDATATYPETYPEID>
<EFFECTIVEFROMDATE>2020-03-11</EFFECTIVEFROMDATE>
<EFFECTIVETODATE/>
<CREATEDDATE>2020-03-11 09:05:58.353</CREATEDDATE>
<LASTMODIFIEDDATE>2020-03-11 09:06:09.567</LASTMODIFIEDDATE>
<STUDENTOBJECTIVEASSESSMENTSCORERESULTBK/>
<ASSESSMENTREPORTINGMETHODTYPEID>24</ASSESSMENTREPORTINGMETHODTYPEID>
<CODEVALUE>Scale score</CODEVALUE>
<DESCRIPTION>Scale score</DESCRIPTION>
<EFFECTIVEFROMDATE>2012-07-01</EFFECTIVEFROMDATE>
<EFFECTIVETODATE/>
<CREATEDDATE>2012-08-01 00:00:00.0</CREATEDDATE>
Assertion is
//Results[1]/ResultSet[1]/Row[1]/FORMATTEDRESULT[1]
#Functions (8, Alg I, Alg II) Scaled Score
Let me know it that helps
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- "#Functions (8, Alg I, Alg II) Scaled Score" did not get what it is.
Few other questions
- how many rows in each iteration? fixed? varies?
- how does a data source row appears for each iteration, assuming that this data is used to verify response.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No it is not a copy paste issue, my expected data is changing, however my actual landing data is being saved in the same column of the database
Few other questions
- how many rows in each iteration? fixed? varies?
[Anand] : If I understand it correctly, you are asking abt the response -if it is, then it is fixed
- how does a data source row appears for each iteration, assuming that this data is used to verify response.
[Anand] : Here is the caveat..the datasource row is changing based on type condition
for eg row 1 : is having 10 column data --( col1, col2, col3, ........col10)
row2 : is having 10 columns data - but out of that 3 columns are different( col1, col2, col13,col14,col15 ..)
hope this helps
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If the column data has expected data, can't that be used in XPath assertion?
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes..that is what i m using in my xpath assertion ...problem is
Let me give u some more insight
Expected Data
R1- c1,c2,c3,c4,c5,c6
R2-c1,c2,c7,c8,c9,c10
Actual Data-Coming from my request
OR1- oc1,oc2,oc3,oc4,oc5,oc6
OR2- oc1,oc2,oc3,oc4,oc5,oc6
R- means row and c means columns and oc - output column,OR- output row
When i am running the loop
Xpath assertion : R1-OR1 -- True
Xpath assertion : R2-OR2 -- false
Reason is OR2 is giving me the output in the same columns, but my expected data which is changing based on some condition.
