From: <fg...@us...> - 2008-01-26 19:07:41
|
Revision: 550 http://openutils.svn.sourceforge.net/openutils/?rev=550&view=rev Author: fgiust Date: 2008-01-26 11:07:44 -0800 (Sat, 26 Jan 2008) Log Message: ----------- docs! Modified Paths: -------------- trunk/openutils-testing/src/site/apt/index.apt Added Paths: ----------- trunk/openutils-testing/src/site/apt/dbunit.apt trunk/openutils-testing-junit/src/site/apt/ trunk/openutils-testing-junit/src/site/apt/index.apt trunk/openutils-testing-testng/src/site/apt/ trunk/openutils-testing-testng/src/site/apt/index.apt Added: trunk/openutils-testing/src/site/apt/dbunit.apt =================================================================== --- trunk/openutils-testing/src/site/apt/dbunit.apt (rev 0) +++ trunk/openutils-testing/src/site/apt/dbunit.apt 2008-01-26 19:07:44 UTC (rev 550) @@ -0,0 +1,76 @@ + -------------------------- + O p e n u t i l s + -------------------------- + Fabrizio Giustina + -------------------------- + + +DbUnit tests + + Openutils provide a base class that take cares of the common operations involved in preparing the test environment using + DbUnit. + + You can extend <<<it.openutils.testing.testng.AbstractDbUnitTestNGSpringContextTests>>> or + <<<it.openutils.testing.junit.AbstractDbUnitJunitSpringContextTests>>>, depending on the test framework of your choice + (remember to include the appropriate dependency, openutils-testing-testng or openutils-testing-junit). + Apart from the underline test framework used, there is no difference in how those class will work. + + Those base classes extend the standard <<<Abstract*SpringContextTests>>> classes provided by Spring, so they support + dependency injection and needs to be configured from a Spring context. + +How to + + All the setup can be configured using annotations. This is a sample test that can make use of data loaded by DbUnit: + ++----------------------------------------------+ + +@ContextConfiguration(locations = {"/spring-tests.xml" }) +@DbUnitExecution(datasets = {"/db1-load.xml" }) +public class SampleDbUnitTest extends AbstractDbUnitTestNGSpringContextTests +{ + @Test + public void testSomething() { + ... + } +} + ++----------------------------------------------+ + + The <<<DbUnitExecution>>> annotation controls how the setup will be performed. It can be configured with a list of file names + (xml od xsl DbUnit datasets) that will be loaded before every single method in this test class is executed. + + In detail the setup that will be performed before each method is: + + * truncate *any table* in the database. This can be turned of by the <<<truncateAll>>> DbUnitExecution parameter + + * load the given datasets into the db + + [] + + You can setup also more than one execution if your tests depend on more than one database or schema, annotating your + class like in this example: + ++----------------------------------------------+ + +@DbUnitConfiguration(dbUnitExecutions = { + @DbUnitExecution(datasets = {"/db1-load.xml" }, dataSource = "dataSource1"), + @DbUnitExecution(datasets = {"/db2-load.xml" }, dataSource = "dataSource2") }) + ++----------------------------------------------+ + + + Note that this test classes don't extend Spring transactional tests, so you need to manually turn on Transactions using + standard Spring annotations: + ++----------------------------------------------+ + +@TestExecutionListeners({TransactionalTestExecutionListener.class }) +@Transactional + ++----------------------------------------------+ + + Also note that the content of your db will definitively be modified by these tests, they are expected to be run on a + test-only instance! + + + Property changes on: trunk/openutils-testing/src/site/apt/dbunit.apt ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Modified: trunk/openutils-testing/src/site/apt/index.apt =================================================================== --- trunk/openutils-testing/src/site/apt/index.apt 2008-01-26 18:39:46 UTC (rev 549) +++ trunk/openutils-testing/src/site/apt/index.apt 2008-01-26 19:07:44 UTC (rev 550) @@ -1,15 +1,27 @@ -------------------------- O p e n u t i l s -------------------------- - Fabrizio Giustina + Fabrizio Giustina -------------------------- openutils-testing + Openutils-testing extends the standard spring testing framework by providing more high-level base testing classes and utils. + In particular, it provides a {{{dbunit.html}framework for using with dbunit in Spring test cases}}. + The openutils-testing jar only contains generic classes that don't depends on any specific test framework. You should + depend on openutils-testing-testng or openutils-testing-junit + + Released versions - Check it at {{{http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing}http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing}} + openutils-testing-testng: + {{{http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-testng}http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-testng}} + + openutils-testing-junit: + + {{{http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-junit}http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-junit}} + Added: trunk/openutils-testing-junit/src/site/apt/index.apt =================================================================== --- trunk/openutils-testing-junit/src/site/apt/index.apt (rev 0) +++ trunk/openutils-testing-junit/src/site/apt/index.apt 2008-01-26 19:07:44 UTC (rev 550) @@ -0,0 +1,20 @@ + -------------------------- + O p e n u t i l s + -------------------------- + Fabrizio Giustina + -------------------------- + +openutils-testing-junit + + openutils-testing-junit is a junit specific extension of openutils-testing. + + See {{{../openutils-testing/}openutils-testing}} for documentation. + + + +Released versions + + openutils-testing-junit: + + {{{http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-junit}http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-junit}} + Property changes on: trunk/openutils-testing-junit/src/site/apt/index.apt ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Added: trunk/openutils-testing-testng/src/site/apt/index.apt =================================================================== --- trunk/openutils-testing-testng/src/site/apt/index.apt (rev 0) +++ trunk/openutils-testing-testng/src/site/apt/index.apt 2008-01-26 19:07:44 UTC (rev 550) @@ -0,0 +1,17 @@ + -------------------------- + O p e n u t i l s + -------------------------- + Fabrizio Giustina + -------------------------- + +openutils-testing-testng + + openutils-testing-testng is a testng specific extension of openutils-testing. + + See {{{../openutils-testing/}openutils-testing}} for documentation. + + + +Released versions + + {{{http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-testng}http://www.mvnrepository.com/artifact/net.sourceforge.openutils/openutils-testing-testng}} Property changes on: trunk/openutils-testing-testng/src/site/apt/index.apt ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |