Forum Discussion
Yes ! I have gone through this experience, where my project file would cost around 70 MB of size with my total testcases count to 250 test cases, with each having 200 test steps as an average. I had solved this problem by few of these solutions,
1) Since my ultimate goal is data driven testing, I separated the data and the testable method and had the dat in external excel sheet and then retained just the necessary method inside SoapUI project file. This gave me an output of just 3 MB project file and with some set of external excel sheets. The time taken to load the SoapUI project has been ideally reduced.
2) Another method is divide and conquer, without following the data driven approach. I would possibly split my project as 5*50 test cases to result 250 test cases, by grouping them based on common flows. This even reduced and some how stopped this problem.
Finally, I would prefer you to follow the solution 1 which really gave an awesome result.
Thanks,
Samy
Okay, what you are saying makes sense to me and I may be able to leverage that for some of my testing. The other part of my testing is also dealing with "missing" data, or when a field is optional. This means that a good portion of my testwill each need their own individual request where the data is not there. Unless there's a way to do this as well?
Some of our NULL tests is to test what happens if the data is blank (empty string), or if the data isn't there. Examples are below. So I think I could potentially use data driven testing for the empty data tests, but have seperate requests to handle each possible element being missing. Thoughts?
Empty Data:
<Element></Element>
or
<Element/>
Missing Data
<!-- <Element/> -->
- kondasamy10 years agoRegular Contributor
Possibly yes! It all lies in the way we are framing the request XML through the data drive approach. I just share my experience in handle this scenario through the below ways,
1) If I leave my cell (Excel cell which holds data) is empty/ null, then probably my customized code should either comment/ pass nothing; which again sends as empty tags (<Element></Element>) or commented tag (<!-- <Element/> --> ), which in no way recognzed by the service.
2) Another method is to feed some specific keywords as ***EMPTY*** in the excel cells. So, that my customized code will consider it as a sign for passing empty tag and would do so.
3) We can even pass the request XML taking directly from an excel sheet/ flat files.
I know there are better ways than this. I hope others would share there points too!
Thanks,
Samy
- groovyguy10 years agoCommunity Hero
I am trying to implement a datasource method to test, and am using this with a request. I add the datasource, import my data, verify it is there, and then go to my request. In my request I right click and say "Get Data" but the Datasource does not show up. All that shows up for options for getting data from is my project and my test suite. Why would this be?
- nmrao10 years agoCommunity Hero
/**
* Below script shows how to build xml using MarkupBuiler with easily
* using element names as need by the user
* just like how xml appears
* (as shown in color code;elements, data)
**/
import groovy.xml.StreamingMarkupBuilder import groovy.xml.XmlUtil
//Define all your namespaces here def nameSpacesMap = [ soap: 'http://schemas.xmlsoap.org/soap/envelope/', ns: 'http://www.domain1.example.com/person', ns1: 'http://www.domain2.example.com/student', xsi: 'http://www.w3.org/2001/XMLSchema-instance' ] //For instance, let us assume the data read[record]
//from datasource def name = 'John' def age = 20 def type = 'Student' def education def adress //How the request can be built. Optionally you can put the
//below code snippet into a function and pass the data
//to it, then retun the request as String like this
/*
* def createRequest(parameter1...parametern){
* //below code goes here and have below line be the last line of function
* // so that will convert it into String
* return XmlUtil.serialize(soapRequest)
*/ def builder = new StreamingMarkupBuilder() builder.encoding ='utf-8' def soapRequest = builder.bind { mkp.xmlDeclaration() namespaces << nameSpacesMap soap.Envelope { soap.Body { //example for element attribute ns.UserRequest (type:type){ ns1.name(name) ns1.age(age) //add education element irrespective of data ns1.education(education) //add address only if there is data if(!address) { ns1.address(address) } } } } } Output will be ---------------------------------------------------------------- <?xml version='1.0' encoding='utf-8'?> <soap:Envelope xmlns:ns="http://www.domain1.example.com/person"
xmlns:ns1="http://www.domain2.example.com/student"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soap:Body> <ns:UserRequest type="Student"> <ns1:name>John</ns1:name> <ns1:age>20</ns1:age> <ns1:education/> </ns:UserRequest> </soap:Body> </soap:Envelope>Click here to see the script and execute.
This is how a dynamic request can be created(using groovy step) with optional element(with if condition), optional data without data(education).
Once that is done you can set the request[soapRequest object will have above output] to next soap request step.
Hope this is helpful.