Re: dbunit-user Digest, Vol 38, Issue 16

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: dbunit-user Digest, Vol 38, Issue 16

Gerardo Albela González
Thanks a lot Dave!

I finally solved this particular problem by just setting a static date well in the future, but I am sure I will use the ReplacementDataSet with many other tests in the future and I really wanted to know how this problem could be addressed with DbUnit.

Thank you very much for your help,
 
Gerardo Albela



De: "[hidden email]" <[hidden email]>
Para: [hidden email]
Enviado: miércoles, 24 de junio, 2009 13:06:04
Asunto: dbunit-user Digest, Vol 38, Issue 16

Send dbunit-user mailing list submissions to
    [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
    https://lists.sourceforge.net/lists/listinfo/dbunit-user
or, via email, send a message with subject or body 'help' to
    [hidden email]

You can reach the person managing the list at
    [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of dbunit-user digest..."


Today's Topics:

  1. Dynamic content on DbUnit tests (Gerardo Albela Gonz?lez)
  2. Re: Dynamic content on DbUnit tests (Dave S-B)


----------------------------------------------------------------------

Message: 1
Date: Tue, 23 Jun 2009 06:11:23 -0700 (PDT)
From: Gerardo Albela Gonz?lez <[hidden email]>
Subject: [dbunit-user] Dynamic content on DbUnit tests
To: [hidden email]
Message-ID: <[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

I have just joined the group so, first of all, hello everybody and thanks in advance for your comments and your help.

I have been for a while now working with Selenium and DbUnit to develop a framework to test the web interface my company offers to our customers.

The problem I have just hit is that there is a section where some actions the users have perfomed are only shown when they have been performed within the last 15 days. For this reason, I would like to do something like the following:

    <tblAction
        pkAction_ID="10000"
        Action="STP"
        FilterFlag="0"
        CreatedBy="p2test"
        CreatedTime="DATE_ADD(CURRENT_DATE(), INTERVAL 2 HOUR)"/>


Unfortunately, that seems not to be accepted on DbUnit, which I believe is expecting to find a 'datetime' value for the CreatedTime field.

Is there any way that you know of doing something similar to that? The only way I can think about right now is to modify the XML file from the Java Selenium test, but it would be nice to avoid that if possible.

Thanks again,
Gerardo Albela


     
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 2
Date: Tue, 23 Jun 2009 15:25:03 +0100
From: Dave S-B <[hidden email]>
Subject: Re: [dbunit-user] Dynamic content on DbUnit tests
To: [hidden email]
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=windows-1252; format=flowed

You can use a ReplacementDataSet (see here for info -
http://www.dbunit.org/components.html - in the IDataSet section).

So, your XML would be something like this...

<tblAction
pkAction_ID="10000"
Action="STP"
FilterFlag="0"
CreatedBy="p2test"
CreatedTime="[created_time]"/>

...and you'd get the dataset like this...

ReplacementDataSet dataSet = new ReplacementDataSet(new FlatXmlDataSet(?));
dataSet.addReplacementObject("[created_time]", dateObject);

... where you've set up the date object to the required date/time beforehand.

Regards
Dave S-B
Lledr Solutions



Gerardo Albela Gonz?lez wrote:

> Hi,
>
> I have just joined the group so, first of all, hello everybody and
> thanks in advance for your comments and your help.
>
> I have been for a while now working with Selenium and DbUnit to
> develop a framework to test the web interface my company offers to our
> customers.
>
> The problem I have just hit is that there is a section where some
> actions the users have perfomed are only shown when they have been
> performed within the last 15 days. For this reason, I would like to do
> something like the following:
>
> <tblAction
> pkAction_ID="10000"
> Action="STP"
> FilterFlag="0"
> CreatedBy="p2test"
> CreatedTime="DATE_ADD(CURRENT_DATE(), INTERVAL 2 HOUR)"/>
>
> Unfortunately, that seems not to be accepted on DbUnit, which I
> believe is expecting to find a 'datetime' value for the CreatedTime field.
>
> Is there any way that you know of doing something similar to that? The
> only way I can think about right now is to modify the XML file from
> the Java Selenium test, but it would be nice to avoid that if possible.
>
> Thanks again,
>
> Gerardo Albela
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Are you an open source citizen? Join us for the Open Source Bridge conference!
> Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
> Need another reason to go? 24-hour hacker lounge. Register today!
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
> ------------------------------------------------------------------------
>
> _______________________________________________
> dbunit-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/dbunit-user

> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.374 / Virus Database: 270.12.88/2196 - Release Date: 06/22/09 18:11:00
>





------------------------------

------------------------------------------------------------------------------


------------------------------

_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user


End of dbunit-user Digest, Vol 38, Issue 16
*******************************************


------------------------------------------------------------------------------

_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user