Contributions
DataSource using Groovy Script
Hi Friends, Good day! I would like to ask some help regarding using the 'Groovy Script' as my data source (since this [Datasource] functionality is not available for non-pro SoapUI). SCENARIO: I have this data from my excel sheet. ___________________________________ | A | B | ___________________________________ 1 |From Currency | To Currency | ---------------------------------------- 2 |USD | AUD | ---------------------------------------- 3 |USD | USD | ---------------------------------------- 4 | InvalidData | GBP | ---------------------------------------- In a Test Case I have 3 Test Step. per test step I need to retrieve the data from the excel file (see table). How I will be able to retrieve this data and use it as my data in my parameters ("From Currency" & "To Currency"). Thanks MY SAMPLE Pseudocode: 1.) Open Excel 2.) Retrieve Data (Column/Row) 3.) Store the Retrieve Data from a variable. Tocurrency[2] & Fromcurrnecy[2] (via iteration) 4.) 1st Test Step use the Fromcurrency[0] & Tocurrnecy[0] (USD to AUD) 5.) 2nd Test Step use the Fromcurrency[1] & Tocurrnecy[1] (USD to USD) 6.) 3rd Test Step use the Fromcurrency[2] & Tocurrnecy[2] (InvalidData to GBP) Sample Request: 1st Test step <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET/"> <soapenv:Header/> <soapenv:Body> <web:ConversionRate> <web:FromCurrency>Fromcurrnecy[0]</web:FromCurrency> <web:ToCurrency>Tocurrency[0]</web:ToCurrency> </web:ConversionRate> </soapenv:Body> </soapenv:Envelope> How I will be able to code this one using a Groovy Script ? Any help will be greatly appreciated! Thanks2.2KViews0likes1CommentRe: Web Service Testing - API (Request / Response Messages)
SmartBear Support wrote: Please see the answers to the questions below 1. I'm totally new with this type of testing. How I will be able to use this SOAPUI tool to trigger a Request ? and to verify its Response ? -If you are testing a Soap Service you will have to feed SoapUI the WSDL of the service will render the Soap messages and you could send request and receive the response with a simple click of a button Please visit this link for more information: http://www.soapui.org/Getting-Started/y ... oject.html If it is a REST service you can feed SoapUI a WADL or directly feed it a URI and SoapUI will automatically render the Request where you can add the parameters that you would like to send in and receive the response and this is also done with a simple click of a button. Please visit this link for more information: http://www.soapui.org/REST-Testing/getting-started.html 2. and what type of project should I use for this type of verification (Request / Response Messages) ? SOAP & WSDL (Project) OR REST (Project) -This depends on your API. If it is a REST api you can use a WADL or the URI. If it is a SOAP api you will have to use a WSDL 3. Can I have some sample on how to test a "Request / Response Messages". -One of the Samples we use is the Google maps API and it is a rest service. Please feed the URI below to SoapUI when you create a REST project and test SoapUI by sending different parameters (directions) and see what the response brings back: http://maps.googleapis.com/maps/api/geo ... nsor=false Regards, Temil Thanks for this VERY HELPFUL TIP . Have a nice day!965Views0likes0CommentsRe: Update - Error loading WSDL (SOAPUI 4.6.4)
SiKing wrote: Works fine for me. eeyoreeco wrote: Error loading [http://www.webservicex.com/CurrencyConvertor.asmx?wsdl]: org.apache.xmlbeans.XmlException: java.net.ConnectException: Connection refused: connect Can you see the WSDL if you try it in your browser? Yup I can access my WSDL in my browser. For now what i did for a workaround is to save the page as .wsdl . May I know also what's the difference between accessing it via .wsdl(save via local) VS direct access of the WSDL ? Thanks11 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.5KViews0likes0CommentsRe: Throw Exception on First Error And Stops
PaulM wrote: Sure thing, I will set up a quick example script that you should be able to use that will perform these actions. //Setting up variables here. def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context); //Change "testName" to the name of the test step you are wanting to perform this on def holder = groovyUtils.getXmlHolder("testName#Request"); def xml = holder.getPrettyXml(); //This regexp grabs all child nodes that have a variable. Note for some odd reason, it leaves the '?' in the request and it also will not make any changes to any null or empty child nodes. The idea here is to start with a valid request def regexp = ("<([^<>]+)>(.*?)</\\1>"); def matcher = xml =~ regexp; //Change testName here again. It might be a better idea to set this as a property or variable in the script. def controlledStep = testRunner.testCase.getTestStepByName("testName"); //This section iterates through each of the regex matches matcher.each { //Here we are taking the match of the XML opening tag and the correct data and replacing it with the XML opening tag and the string "BadData". For example, if you use "<XML>hey!</XML>" it will replace it with "<XML>BadData</XML>". If you want specific data in each cell just use it[1] (The opening XML tag) to grab a property named with it. def newXml = xml.replaceAll("<"+it[1]+">"+it[2],"<"+it[1]+">"+"BadData"); //Putting the bad data into the testStep's request controlledStep.setPropertyValue("Request",newXml); //Running the testStep. Again, replace testName. def result = testRunner.runTestStepByName("testName"); //I am just logging out the assertion. You can do anything you want here. log.info controlledStep.getAssertionStatus().toString(); } //After it loops through every single child node, replacing only the values of that child node. I do not want to completely destroy the test step so I put the initial XML back into the test step. Always clean up your mess. controlledStep.setPropertyValue("Request",xml); If you need further assistance please ask. I commented it thoroughly so that you can hopefully see what is going on with the script. It's pretty simple overall. Thanks Paul! I'll give a try for this one. Have a nice day!1.3KViews0likes0CommentsRe: Throw Exception on First Error And Stops
PaulM wrote: eeyoreeco wrote: PaulM wrote: This is a server side issue. Essentially, your dev team would have to create this. The problem is, why? If it continues to parse a request that it knows is faulty than it is wasting processing speed. Which in turn costs more money. Actually the reason why I'm asking this, so that in just one run of 'request' I will be able to verify all the validation for all parameters that are in the xml request. (for testing purposes - negative scenario) Yes, I understand that this would make testing far easier but as I said, it would require development to change the code to continue parsing the data after invalid data is found on the server side. While this would be amazing for testing purposes in production this would be horrible since it will consume all of the standard resources that a failed example would consume. If you want development to make a change that will hinder production and cost your company FAR more money just to make testing easier. Instead of wanting that, why not set up a groovy script that will constantly replace a single node with a faulty parameter and then run the test case over and over again to verify the failures? Thanks Paul!. would you be able to help me regarding of using a groovy script that will constantly replace a single node with a faulty parameter and then run the test case over and over again ?1.3KViews0likes0CommentsUnauthorized Issue - REST
Please check and advise. Thanks <HTML> <HEAD> <TITLE>Unauthorized</TITLE> </HEAD> <BODY> <H1>Unauthorized</H1> Proper authorization is required for this area. Either your browser does not perform authorization, or your authorization has failed. </BODY> </HTML>1.1KViews0likes1CommentRe: Throw Exception on First Error And Stops
PaulM wrote: This is a server side issue. Essentially, your dev team would have to create this. The problem is, why? If it continues to parse a request that it knows is faulty than it is wasting processing speed. Which in turn costs more money. Actually the reason why I'm asking this, so that in just one run of 'request' I will be able to verify all the validation for all parameters that are in the xml request. (for testing purposes - negative scenario)1.3KViews0likes0CommentsThrow Exception on First Error And Stops
Hi All, Please help me with this one. Usually when an Error (1st) is being encountered the validation of the other parameters stops. Just like in my sample request and the fault string below. Is there any way so that all the parameter will be validated. In this case I want to see that both "FromCurrency" and "ToCurrency" to be validated in just one run of request. Thanks for the help. REQUEST: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET/"> <soapenv:Header/> <soapenv:Body> <web:ConversionRate> <web:FromCurrency>BBB</web:FromCurrency> <web:ToCurrency>AAA</web:ToCurrency> </web:ConversionRate> </soapenv:Body> </soapenv:Envelope> FAULT STRING: <faultstring>System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (5, 50). ---> System.InvalidOperationException: Instance validation error: 'BBB' is not a valid value for Currency.1.9KViews0likes6CommentsRe: Error loading WSDL in 4.6.4
In my case, I have this type of error: Error loading WSDL - There was something wrong with the WSDL you are trying to import Error loading [http://www.webservicex.com/CurrencyConvertor.asmx?wsdl]: org.apache.xmlbeans.XmlException: java.net.ConnectException: Connection refused: connect2.6KViews0likes0Comments