8 Replies Latest reply on Oct 31, 2011 6:00 AM by bmajsak

    DBUnit Integration using DBUnitSeamTest as a model

    john.genoese

      I'm thinking of building a DBUnitArquillian class after the manner of DBUnitSeamTest. I haven't come across any formal integration of DBUnit with Arquillian as yet, and I used DBUnitSeamTest greatly in my Seam 2.x app. The question I would like to discuss is twofold:

      1. Is this effort redundant i.e. already been done?

      2. Has this whole approach been rendered redundant? Is there a newer "Arquillian way" that I simply missed?

        • 1. Re: DBUnit Integration using DBUnitSeamTest as a model
          bmajsak

          Hi John,

           

          actually I'm working on Arquillian extension for managing persistence-related tests, similar to Unitils (which is powered by DBUnit under the hood). There is already a discussion based on my PoC (you can find the link to original blog post in the first message). I will put my stuff on my github account in next few days so if you want we can work together to make it pass the alpha stage

          • 2. Re: DBUnit Integration using DBUnitSeamTest as a model
            john.genoese

            I had a suspicion that this might be the case. Thanks so much for replying. I will review the material you referenced and then we'll figure out how I can help. I was going to model my solution after DBUnitSeamTest, but it sounds like you have an approach more consistent with the Arquillian way of doing things. I am just beginning my acquaintance with this, so I'll follow your lead here.

            • 3. Re: DBUnit Integration using DBUnitSeamTest as a model
              dan.j.allen

              I'm thrilled to see this effort underway. I can tell you without a doubt this extension will get lots of usage. I get asked about it all the time. Keep us posted!

              • 4. Re: DBUnit Integration using DBUnitSeamTest as a model
                bmajsak

                Hi guys,

                 

                so yesterday I pushed the very first version on GitHub. It's based on my old PoC which was evaluated more by Nick later on. It's not based on JUnit rules anymore, but "aspires" to be Arquillian extension.

                 

                It's still under heavy development (you will see some TODOs in the code ), so don't treat it as a final product (yet), but I'm fully committed to go with alpha very soon. Let me know if you have any suggestions for the features or if you spot some poor code don't hesitate to comment in GitHub directly

                 

                Few notes what's done:

                • Supported formats (DBUnit)
                  • XML
                  • XLS
                  • YAML
                • Transactional support
                • Comparing DB state at the end of the test
                • Tested against Glassfish Embedded 3.1 with Apache Derby and HSQLDB

                 

                Still pending (work in progress):

                 

                • Dynamic dependency resolvers
                  • Determine what libs to include in deployment for given test (Excel, JSON, YAML tc)
                • More DBUnit formats
                  • JSON
                  • CSV
                • Tests in multiple containers  (including remote ones) with different DBs, using TestNG and Spock runners.

                 

                 

                I also think that using not so low-level data sets would be more convenient for the users. So instead of talking on db tables level we might think about supporting entities (more OO way )

                 

                You should expect much more stuff pushed over the next few days! Stay tuned!

                • 5. Re: DBUnit Integration using DBUnitSeamTest as a model
                  john.genoese

                  That's wonderful. I will test-drive it starting right now. I must tell you however that I am on the steep side of the learning curve not only with Arquillian, but with Git (I'm a SVN guy) and the whole JEE6 stack as well. Hence, this will take a while, but I'm eager to dive in and help any way I can. In the course of converting my Seam2/JEE5/JBoss 5.1 project to Seam3/JEE6/JBoss 7.0.2,  I am sure that I will encounter scenarios that will prove quite useful to you in this endeavor.

                   

                  I will share my results as I go along. Would you prefer a different venue for me to do that, or is this one sufficient?

                   

                  Thank you again for doing this.

                  • 6. Re: DBUnit Integration using DBUnitSeamTest as a model
                    bmajsak

                    Feel free to play around with it. The earlier I got the feedback the better. Will definitely help me to put it on the right track.

                     

                    As I said it's more an early preview and is not complete. Most likely it won't work yet in remote containers because of deployment appender which is not yet committed on GitHub, but I'm already working on that. Over next few days you should expect quite a lot of commits (this evening as well ).

                     

                    You are more than welcome to fork the project and improve it in any way you want (could be just additional test or whatever you feel is important). If you spot something you can open an issue on GitHub and I'll take care of it. Or you can simply fix it and make a pull request That's the beauty of open source and GitHub makes it insanely easy! BTW GitHub has really nice tutorial on using Git. Moreover you can have a look on Pro Git or Git ready.

                     

                    I'm looking forward to hearing from you!

                    • 7. Re: DBUnit Integration using DBUnitSeamTest as a model
                      bmajsak

                      Hi guys,

                       

                      quick update: today I added YAML support for DBUnit.

                       

                      Next step -> testing in remote container

                      • 8. Re: DBUnit Integration using DBUnitSeamTest as a model
                        bmajsak

                        Hi guys!

                         

                        Quick update - now it's an offical extension! https://github.com/arquillian/arquillian-extension-persistence