Contributions
Re: Groovy XML Script for Loops
Thanks for the response. I am looking for a way when I need to generate an XML from another XML Response(s). In example below, I have a student list of 50 students and a teacher list of 3 teachers. I want an sections assingnments XML as the output where each teacher is assigned to a section, and upto 20 students are assigned in that section. So I need to loop on each teacher element, and for each teacher element, loop on the student name from 1-20, than for 2nd teacher, students 21-40 etc. Ex: I have a XML list of students, say a simple format as follows: <Students> <name> st name 1</name> <name> st name 2</name> <name> st name 3</name> .. .. <name> st name 50</name> </Students> And XML list ofteachers: <Teachers> <name> Teachername 1</name> <name> Teacher name 2</name> <name> Teacher name 3</name> <name> st name 50</name> </Teachers> I want a result to look as follows: <Assignments> <Section> <id>1 </id> <teacher>Teachername 1</teacher> <studentList> <name> st name 1</name> <name> st name 2</name> .. .. <name> st name 20</name> </studentList> </Section> <Section> <id>2 </id> <teacher>Teachername 2</teacher> <studentList> <name> st name 21</name> <name> st name 22</name> .. .. <name> st name 40</name> </studentList> </Section> <Section> <id>3 </id> <teacher>Teachername 3</teacher> <studentList> <name> st name 41</name> <name> st name 42</name> .. .. <name> st name 50</name> </studentList> </Section>4.6KViews0likes1CommentGroovy XML Script for Loops
Hi: I have an example XML as follows: <Element> <row></row> <row></row> <row></row> <row></row> <row></row> <row></row> <row></row> <row></row> </Element> Can someone suggest a syntax to loop around this XML, say from rows 4-6 only? I have tried a For-each loop, that that seems to iterate thru all rows. ThxSolved4.7KViews0likes3CommentsWhat is the best way to implement a loop with counter in readyAPI?
Trying to figure out a real simple way of implementing this: 1. Read a counter from some property 2. Repeat a set of test steps for that counter or until an exit condition ThanksSolved8 years agoPlace ReadyAPI QuestionsReadyAPI Questions3.3KViews0likes2CommentsRe: Nesting a multirecord datasource into a XML Hierarchy
Hi: I was trying to simulate a simple scenario where the total count of Rec is variable can be changed and still produce xml with 5 or 20 or 30 Rec. for example if a class list can have any number of students, but want to make sure the class size is variable. Even if fixed, how can I get multiple records? I tried the index[i] as an option, but that did not work.8 years agoPlace ReadyAPI QuestionsReadyAPI Questions994Views0likes0CommentsNesting a multirecord datasource into a XML Hierarchy
Thanks to the amazing community. I hope to learn something new hear, and my posts might be very basic. This is Data driven test case: <Header> <Record1>value1</Record1> </Header> <Detail> <Rec>value1</Rec> <Rec>value2</Rec> <Rec>value3</Rec> </Detail> I am trying to create the above soaprequest using 2 datasources that read form excel. I want to get Record1 from one sheet (a single record), and from another sheet, multiple records of Rec. I am wondering if Index is allowed in the GetValue function. I tried index, but don't seem to get anything. If Index is allowed, what might be a way to read multiple records from an Excelsheet and add data. (I don't want a SOAP request per record, rather a single SOAPrequest (with 2 or more Rec). Thx8 years agoPlace ReadyAPI QuestionsReadyAPI Questions1KViews0likes2Comments