Contributions
Re: SetUp Scripts for current and future dates
Ok, I did this. Probably much nicer ways to do it, but ... //Parse table row returned def dbNewDbu = context.expand( '${check DBU really changed#ResponseAsXml#//root[1]/data[1]/reset[1]}' ) dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date dbValAsDate = dateFormat.parse(dbNewDbu); // Set up a pair of calendar object for date manipulation def a = Calendar.getInstance(); def b = Calendar.getInstance(); // set them now + 30 days +/- 5 minutes in case of time sync differences a.add(Calendar.DATE,30); b.add(Calendar.DATE,30); a.add(Calendar.MINUTE,-5); b.add(Calendar.MINUTE,5); // get 2 date objects from Calendar objects, so we can do assertion with before and after methods Date aDate = a.getTime(); Date bDate = b.getTime(); s1= dateFormat.format(aDate); s2= dateFormat.format(dbValAsDate); s3= dateFormat.format(bDate); assert (dbValAsDate.after(aDate) && dbValAsDate.before(bDate)); so, for smartTest's problem above, use the Calendar object to do the manipulation, and then convert to date object with Calendar.getTime() Hope this helps. David8KViews0likes0CommentsRe: SetUp Scripts for current and future dates
I'd be really interested in this also: I run a REST request to update a db column to now()+30days, then a second REST query to get the row back - I'd like to set an assertion returned value (in xml) = date_value (to within a minute or so) I assume the assertion would need to be a groovy script. the within a minute or so is because column on db is datetime, and there's naturally some lag between updating and re-checking. David8.1KViews0likes0Comments[Resolved] Simple Assert needed
My REST service returns this xml : <root> <error>200</error> <errorText>OK</errorText> <data> <id>215901</id> <core_range>844</core_range> <core_number>1112233</core_number> <destination>07899999999</destination> <mapper>rest.api.AutoMap.Done</mapper> <status>mapped</status> <comment/> <mapping_attempts>6</mapping_attempts> <log><![CDATA[Auto map log = lots of stuff ]]></log> <reset/> </data> <loggedIn>1</loggedIn> <yourSession>k8vm88govpc69o7q5m00kluj41</yourSession> </root> How do I add an assertion that <mapping_attempts> is between 1 and 20 ? I guess I need to get the node, and cast to int, but I have no idea how ! David13 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.8KViews0likes2CommentsProperty Expansion in Assertion
We deal with phone numbers. I have a value is a properties test step, called currentRange, value '0844'. It has to be that form, as its required that way in the URL REST step. I then make a diagnostic call to the API to check previous call went well. The xml returned is similar to: <root> <error>200</error> <errorText>OK</errorText> <data> <id>123456</id> <core_range>844</core_range> <core_number>1234567</core_number> <destination>07123123123</destination> <mapper>foo</mapper>... So compare XPath Expression //root[1]/data[1]/core_range[1]/text() with ${Properties#currentRange}, I want to fix the assertion that core_range xpath item (844) is same as (0844), which it isn't, in this form. It seems like property expansion, ${=... is where I should be looking, to coerce the string 0800 to int, or something, but I can't seem to get it right. Any ideas ? David13 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.7KViews0likes2CommentsRe: Advice re Sessions and DataSource looping please
Yeah, very odd. I can export and send the test case to support, if that would help. Yes, sessions are cookie based, and Maintain HTTP sessions is ticked. The weird parts are a) can run steps individually b) Raw request info contains 2 cookie entries: GET https://staging.api.codebluestats.co.uk ... 7805545174 HTTP/1.1 Accept-Encoding: gzip,deflate Cookie: PHPSESSID=9jbtlj1v2bdh7bgi8lt8vd0tj4 User-Agent: Jakarta Commons-HttpClient/3.1 Host: staging.api.codebluestats.co.uk Cookie: $Version=0; PHPSESSID=9jbtlj1v2bdh7bgi8lt8vd0tj4; $Path=/ I would appreciate some help here, as I am very new to SoapUI, and I don't even know if I'm approaching this correctly. David13 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.6KViews0likes0CommentsAdvice re Sessions and DataSource looping please
Not sure what I'm doing wrong, I would appreciate some help/advice. I'm using SoapUI 4.0.0, and I've been using it for the grand totoal of about 8 hours so far, so I'm very much new to this. I'm trying to put together a test suite to exercise part of our api. The test steps are as follows: 1 Properties 2 "REST Login" 3 Property Transfer 4 MySQL DataSource 5 "REST can" 6 Datasource Loop Properties holds one item, sessionID REST login performs a login to our service. XML returns (for example) <root> <error>200</error> <errorText>OK</errorText> <data/> <loggedIn>1</loggedIn> <yourSession>1t1972j5p8tmua4n58bdcid2q6</yourSession> </root> Property transfer has one transfer, named sessionID, which does an xpath lookup of //yourSession from REST Login ResponseAsXML, to Target: Properties Property: sessionId MySQL Datasource picks up 2 columns from a local database, Range and Number (Limit 5 rows, for testing) REST can is a call to our api, url of form http://mydomain/rest/7310/canMapNumber/<RANGE>/<NUMBER>?rt=xml&to=012345678 Range parameter in url is value ${MySQL DataSource#test_range} Number parameter in url is ${MySQL DataSource#test_number} There is one Header for the call: Header: Cookie Value: PHPSESSID=${sessionId} When I run the Test Case, The MySQL bit works great - each call is constructed correctly with values from database. However, Each call fails with "Not Logged In" error from api, and when I look at the Raw request info, I see: GET https://mydomain/rest/7310/canMapNumber ... =012345678 HTTP/1.1 Accept-Encoding: gzip,deflate Cookie: PHPSESSID=1t1972j5p8tmua4n58bdcid2q6 User-Agent: Jakarta Commons-HttpClient/3.1 Host: mydomain Cookie: $Version=0; PHPSESSID=1t1972j5p8tmua4n58bdcid2q6; $Path=/ which has 2 Cookies for PHPSESSID. Any idea what I'm doing wrong ?13 years agoPlace ReadyAPI QuestionsReadyAPI Questions3.2KViews0likes5Comments