|
From: John H. <joh...@gm...> - 2013-03-14 07:14:22
|
Hello, I am very interested in alternative formats for DbUnit and would consider putting this implementation into the core. The second entry provides new default values for some columns. Does that mean that the full list of columns from the first entry is retained? What if the second entry mentions new columns? What happens to the ordering? I think the idea of default values is a very interesting one for DbUnit and probably should be supported somehow as a specific concept separate from specific dataset formats. Personally I think that YAML suffers from the same basic problem as XML -- it is essentially hierarchical, not tabular. In my work lately we have been using the Creativyst Tabular Exchange format (http://www.creativyst.com/Doc/Std/ctx/ctx.htm). I have written simple DbUnit support for it and it is working pretty well. If I interpret your example correctly, it would look like this in CTX: \T mytable \L id | name | description | version | created_by | last_modified_by 1 | Just | The first row | 0 | 1 | 1 2 | another | The second row | 0 | 1 | 1 3 | example | (NULL) | 0 | 1 | 1 4 | created by | (NULL) | 0 | 4 | 2 5 | another user | (NULL) | 0 | 4 | 2 (Meant to be read monospaced.) We've found this makes for nice clean inline datasets. (We tend to embed test data in test code.) I need to get this into DbUnit core at some point too. (The current impl is in Groovy, I need to rewrite it in Java.) More later. (Train reaching station.) Regards John Hurst On Thu, Mar 14, 2013 at 4:31 AM, Roy Brokvam <roy...@do...> wrote: > (Sorry about sending that previous incomplete snippet!) > > I know Arquillian Persistence Extension supports YAML datasets, but that > one has two major shortcomings: > * It's part of a bigger testing framework that not all DbUnit users use > * It doesn't exploit YAML's structured model - it's basically just another > simple dataset > > At my work, I have started specifying a YAML dataset format that uses > positional values (less need to name each value for every row) and default > values (less need to mention each column in each row). I'm pretty sure that > others have the same problem that we're trying to solve: Unnecessary long > FlatXml datasets that are really hard to read. > > An illustrative example along the lines I'm thinking: > > - mytable: > columns: [ id, name, description, version: 0, created_by: 1, > last_modified_by: 1 ] # defines order and default values > rows: > - [ 1, "Just", "The first row" ] > - [ 2, "another", "The second row" ] > - [ 3, "example" ] # No comment here, default is null > > - mytable: > columns: { created_by : 2, last_modified_by : 2 } # new default values > rows: > - [ 4, "created by" ] > - [ 5, "another user" ] > > I am also thinking of including some sequence generating mechanism, as > well as supporting YAML anchors and aliases. > > I am encouraged by my employer to provide the specification and an > implementation of it to the open source community, and DbUnit would of > course be a natural home for it. The question is - is there any chance that > such an extension would be included, or should I just create a separate > open source project for it? > > Regards, > RoyB > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_mar > _______________________________________________ > dbunit-developer mailing list > dbu...@li... > https://lists.sourceforge.net/lists/listinfo/dbunit-developer > > -- Life is interfering with my game |