Have you tried using ant's <sql> task? I run webtest through ant but I believe this should also work if you use the bat files? I created a macro where I can pass in the connection info and sql to run, I've included it below as an example, if you want to run an actual file you just set the src attribute of the <sql> task http://ant.apache.org/manual/CoreTasks/sql.html: <macrodef name="runSQL"> <attribute name="server"/> <attribute name="database"/> <attribute name="sql" default=""/> <attribute name="login"/> <attribute name="DBpassword"/> <sequential> <sql driver="net.sourceforge.jtds.jdbc.Driver" url="jdbc:jtds:sqlserver://@{server}/@{database}:1433" userid="@{login}" password="@{DBpassword}" > <classpath> <pathelement location="../lib/jtds.jar"/> </classpath> @{sql} </sql> </sequential> </macrodef>
Hope this helps, Will ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tokutan Sent: Tuesday, September 09, 2008 6:28 PM To: [email protected] Subject: [Webtest] Re: testing JSON web services Hi Marc, Thanks for replying. From what i have gathered, Web services is a rest-based and outputting JSON as the expected output. I have played around with webtest with invoke contentfile and Webtest does recognise the output. However, at the moment management is more inclined to use JMETER for this purpose as we need to connect to mysql via JDBC in order to clean up the database prior to running the test. I find JMETER to be really basic in terms of functional web testing as it is more towards performance testing I need to present to the management the benefit of using Webtest for this web services testing. I have managed to use SQLunit to connect mysql via JDBC , however I have not figured out how to incorporate SQLUnit inside webtest script (I have just managed to run SQL unit individually by telling it to output webtest report by this command:ant sqlunit-nested canoo2html -Dtestdir=testwedi -Dlog.format=canoo -Doutput.file=results.xml -Dwebtest.style=WebTestReport Lets say I have the following simple webtest script: <!DOCTYPE project SYSTEM "../dtd/Project.dtd"> <project default="test"> <target name="test"> <dataDriven tableContainer="testsip.xls" table="testjson"> <webtest name="check soap"> <config haltonerror="false" haltonfailure="false" > <option name="ThrowExceptionOnScriptError" value="false" /> <option name="ThrowExceptionOnFailingStatusCode" value="false" /> <header name="User-Agent" value="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14<http://1.8.1.14>) Gecko/20080404 Firefox/2.0.0.14<http://2.0.0.14>"/> </config> <invoke method="GET" url="${URL}"/> <applyFilters> <matchLinesFilter regex="\d"/> </applyFilters> <verifyContent referenceFile="json.html"/> </webtest> </dataDriven> </target> </project> And I have the following simple SQLunit script: <test name="Checking returned value from customer" failure-message="Returned value check for customer failed"> <sql> <stmt>SELECT category_alias_name FROM Fads_ForQARnD.category_alias_to_c1_category_mappings where category_alias_name ='Banking'</stmt> </sql> <result> <resultset id="1"> <row id="1"> <col id="1" name="category_alias_name" type="VARCHAR">Banking</col> </row> </resultset> </result> How can i incorporate SQLunit script inside webtest script so webtest will run SQLunit script firstly and then running subsequent webtest script? Thanks </test>

