Class DbUnitJunitRunner
- java.lang.Object
-
- org.junit.runner.Runner
-
- org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
-
- org.junit.runners.BlockJUnit4ClassRunner
-
- com.github.mjeanroy.dbunit.integration.junit4.DbUnitJunitRunner
-
- All Implemented Interfaces:
org.junit.runner.Describable
,org.junit.runner.manipulation.Filterable
,org.junit.runner.manipulation.Orderable
,org.junit.runner.manipulation.Sortable
public class DbUnitJunitRunner extends org.junit.runners.BlockJUnit4ClassRunner
Implementation of JUnitRunner
to fill and clear database between each tests.
Basically, this class addDbUnitRule
to the test class when this runner is initialized.
DbUnit configuration should be set usingDbUnitConnection
configuration:@RunWith(DbUnitJunitRunner.class) @DbUnitConnection(url = "jdbc:hsqldb:mem:testdb", user = "SA", password = "") @bUnitDataSet("classpath:/dataset/xml") public class MyDaoTest { @Test public void test1() { // ... } }
-
-
Constructor Summary
Constructors Constructor Description DbUnitJunitRunner(Class<?> klass)
Create runner.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<org.junit.rules.TestRule>
getTestRules(Object target)
-
Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner
collectInitializationErrors, computeTestMethods, createTest, createTest, describeChild, getChildren, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, runChild, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout
-
Methods inherited from class org.junit.runners.ParentRunner
childrenInvoker, classBlock, classRules, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, order, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolation
-
-
-
-
Constructor Detail
-
DbUnitJunitRunner
public DbUnitJunitRunner(Class<?> klass) throws org.junit.runners.model.InitializationError
Create runner.- Parameters:
klass
- Running class.- Throws:
org.junit.runners.model.InitializationError
- If an error occurred while creating Jdbc connection factory.
-
-