|
From: Roberto Lo G. <rlo...@gm...> - 2010-12-28 09:03:46
|
I found the work on Annotations very useful but my idea on annotations is a
little bit different, may be a bunch of code can be more expressive than a
long email....
// Initialization dataset
@TestDataSet(value = "invoice.xml", format = Format.FLAT_XML)
public class UsageExample {
@TestConnection(url = "jdbc:", type = TestConnection.Type.JDBC, username =
"sa", password = "", setUp = DatabaseOperation.CLEAN_INSERT, tearDown =
DatabaseOperation.NONE)
public Connection connection;
@Test
@TestDataSet.Composite({
@TestDataSet("http://www.dbunit.org/users.xml"),
@TestDataSet(value = "file://test/orders.xml", format = Format.FLAT_XML) })
public void multipleURLDataSetWithSameFormat(DataSet expected) {
DataSet actual = connection.createDataSet("SOMETHING");
assertEquals(expected, actual);
}
}
Notice the dataset parameter which will be injected with the dataset... A
parameter level annotation could be better allowing for method level
initialization dataset AND method level expected dataset, but I think it
will clutter the code...
I think a field level annotation to provide the connection is required, we
can go for a static field too, or for a class level annotation plus an
annotated field/method... But we must have no more than one connection per
test class or we will not be able to choose which one use to load the
initialization dataset...
On Thu, Nov 4, 2010 at 23:21, John Hurst <joh...@gm...> wrote:
> Forwarded to both lists, because David apparently had trouble getting it to
> the user list.
>
> Sounds interesting David. I look forward to having a look soon.
>
> John Hurst
>
> ---------- Forwarded message ----------
> From: David <spo...@us...>
> Date: Fri, Nov 5, 2010 at 11:09 AM
> Subject: Annotations for DBUnit
> To: go...@us..., jb...@us...,
> jef...@us..., rlo...@us...
>
>
> Hello,
>
> First of all, I really like DBUnit.
> One of the great missing feature is undoutedly the support for annotations
> to
> speed up the development. I found out this feature is planned in DBUnit 3
> roadmap.
>
> On a previous project I worked on, the team decided to implement a really
> simple support for annotations. Based on this idea, I decided to develop a
> much more complete implementation.
>
> I haven't decided to create a dedicated project. For me, it is only
> a proof of concept.
>
> If you want to take a look at it, you can find the maven project here
>
> http://dl.dropbox.com/u/9788568/dbunit-annotations-20101101.zip
>
> In this project the tests are not really unit tests. They are merely
> samples.
>
> My objectives are the followings :
> * Provide a complete set of annotations (only a subset of data set related
> annotations are implemented now)
> * Provide an extension mechanism to let development teams design their own
> annotations according to their test strategy (done through the
> DateSetFactory
> annotation)
> * Guarantee independence with the test framework (only JUnit 4 is supported
> but the core implementation does not rely on it)
> * Speed up the development by requiring as less code as possible to
> integrate
> DBUnit and let the developpers focus on the test itself.
>
> I hope you can find an interest in this PoC
> Thanks
> David
>
> PS: My first intention was to send this email at dbunit-
> us...@li... but I never received confirmation email for my
> subscription.
>
>
>
>
> --
> Life is interfering with my game
>
>
> ------------------------------------------------------------------------------
> The Next 800 Companies to Lead America's Growth: New Video Whitepaper
> David G. Thomson, author of the best-selling book "Blueprint to a
> Billion" shares his insights and actions to help propel your
> business during the next growth cycle. Listen Now!
> http://p.sf.net/sfu/SAP-dev2dev
> _______________________________________________
> dbunit-developer mailing list
> dbu...@li...
> https://lists.sourceforge.net/lists/listinfo/dbunit-developer
>
>
|