How to extract values of a ITable and save its data to a csv file?
Posted on 2009-04-16
I am working with DBUnit and sending a query to the database ITable actualData = getConnection().createQueryTable("RESULT_NAME","Select * from districts where id=3");
assertNotNull("error", actualData); // My resultset should be always null !
and now I need to get the values of this query and save it in a CSV file together with the error message which explain where and why the error ocurr in the assertNotNull..
How can I extract this values and then write them into a file? I have tried with CsvDataSetWriter.write(actualData, "c:\\queries.cvs"); but this method required and IDataSet.
and how can I get the error message thrown by failNotEquals? because this explain where and why the error occurred and I need to catch that error message and write it together with the result of the previous question.
Thanks in advance.