|
From: Benoit X. <bx...@ap...> - 2010-01-22 18:18:40
|
May be I'm missing something but I'd like to use the idataset interface to
assert 2 tables directly.
The expected result is in csv in a resource as you describe but I cannot
find a way to give that URL/resource to a DataSet so I could get 2 ITables
to compare...using dbunit assert. CsvDataset seems to only accept a
directory not a URL.
Is there another way to create an itable based on a URL?
Thanks a lot
B
-----
Important Notice
This communication contains information that is considered
confidential and may also be privileged. It is for the exclusive use
of the intended
recipient(s). If you are not the intended recipient(s) please note that any
form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful. If you
have received
this communication in error please return it to the sender and
delete the original
On 22 Jan 2010, at 18:02, Luiz Eduardo Guida Valmont <leg...@gm...>
wrote:
If your test/resources structure mimics that of the src/main/java, all you
have to do is call *classLoader.findResource( "resource.csv" );*. I mean, if
you have file *a.csv* at *test/resources/com/company* and a test class *
TestSomething* at *test/main/java/com/company* then all you need is
call *classLoader.findResource(
"resource.csv" );* and voilà.
2010/1/22 Benoit Xhenseval <bx...@ap...>
> Hi
>
> Thanks for the reply. Can you then give the URL to CsvDataSet of some sort
> ?
>
> Regards
>
> Benoit
>
> -----
> Important Notice
> This communication contains information that is considered
> confidential and may also be privileged. It is for the exclusive use of
> the intended recipient(s). If you are not the intended recipient(s) please
> note that any form of distribution, copying or use of this communication
> or the
> information in it is strictly prohibited and may be unlawful. If you have received
> this communication in error please return it to the sender and
> delete the original
>
> On 22 Jan 2010, at 17:44, Luiz Eduardo Guida Valmont <leg...@gm...>
> wrote:
>
> Benoit,
>
> You can create a base test class that will handle this on the setUp method
> and another method that will tell where to look for files. All you have to
> do is something like this:
>
> Class clazz = getClass();
>
> ClassLoader classLoader = clazz.getClassLoader();
>
> URL resource = classLoader.findResource( "someResource.dat" );
>
>
> Also, if I'm not mistaken, you can do some overriding and then get to know
> which test method you're actually about to run. That said, you can have
> custom expected-results-csv's on a per-method basis.
>
> ... that is, if I understood your problem well. ;)
>
> Regards,
> Luiz
>
> 2010/1/22 Benoitx < <bx...@ap...>bx...@ap...>
>
>>
>> Hi
>>
>> What is the best way to include the expected results amongst the classes
>> in
>> the jar files.
>>
>> I would not want to use a File as such but I cannot find any other way.
>>
>> At the moment, the csv files are copied by Maven from the test/resources
>> sub-directory to the equivalent under target/test-classes. But would it
>> be
>> possible to use a proper classpath finder for those?
>>
>> At the moment I have:
>>
>> IDataSet expectedDataSet = new CsvDataSet(new
>>
>> File("h:/MyProject/dev/project-web/target/test-classes/com/company/dept/project/longrunning/dao/"));
>>
>> Is there a better way to say that package com.company... has the CSV files
>> to be expected?
>>
>> I would not want to hardcode the drive and directory...
>>
>> Any better / standard way to achieve this?
>>
>> Thanks
>>
>> Benoit
>>
>> -----
>> Thanks & Regards,
>>
>> Benoit
>>
>> <http://www.Appendium.com>http://www.Appendium.com
>> <http://objectlab.blogspot.com>http://objectlab.blogspot.com
>>
>> --
>> View this message in context:
>> <http://old.nabble.com/Best-way-to-include-expected-CSV-results-in-test-jar--tp27276053p27276053.html>
>> http://old.nabble.com/Best-way-to-include-expected-CSV-results-in-test-jar--tp27276053p27276053.html
>> Sent from the DBUnit - Users mailing list archive at Nabble.com.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Throughout its 18-year history, RSA Conference consistently attracts the
>> world's best and brightest in the field, creating opportunities for
>> Conference
>> attendees to learn about information security's most important issues
>> through
>> interactions with peers, luminaries and emerging and established
>> companies.
>> <http://p.sf.net/sfu/rsaconf-dev2dev>http://p.sf.net/sfu/rsaconf-dev2dev
>> _______________________________________________
>> dbunit-user mailing list
>> <dbu...@li...>dbu...@li...
>> <https://lists.sourceforge.net/lists/listinfo/dbunit-user>
>> https://lists.sourceforge.net/lists/listinfo/dbunit-user
>>
>
>
> ------------------------------------------------------------------------------
> Throughout its 18-year history, RSA Conference consistently attracts the
> world's best and brightest in the field, creating opportunities for
> Conference
> attendees to learn about information security's most important issues
> through
> interactions with peers, luminaries and emerging and established companies.
> http://p.sf.net/sfu/rsaconf-dev2dev
>
> _______________________________________________
> dbunit-user mailing list
> dbu...@li...
> https://lists.sourceforge.net/lists/listinfo/dbunit-user
>
>
>
> ------------------------------------------------------------------------------
> Throughout its 18-year history, RSA Conference consistently attracts the
> world's best and brightest in the field, creating opportunities for
> Conference
> attendees to learn about information security's most important issues
> through
> interactions with peers, luminaries and emerging and established companies.
> http://p.sf.net/sfu/rsaconf-dev2dev
> _______________________________________________
> dbunit-user mailing list
> dbu...@li...
> https://lists.sourceforge.net/lists/listinfo/dbunit-user
>
>
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for
Conference
attendees to learn about information security's most important issues
through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
dbunit-user mailing list
dbu...@li...
https://lists.sourceforge.net/lists/listinfo/dbunit-user
|