Could not run parameterized with DBUnitRule with database rider > 1.2.9
See original GitHub issueLookup for method annotations fails with parametrized tests in DBUnitRule.apply:
java.lang.RuntimeException: Could not find method shouldJustRunMoreThanOneTime[0] on test class ParameterizedTest
at com.github.database.rider.core.util.AnnotationUtils.findAnnotation(AnnotationUtils.java:179)
at com.github.database.rider.core.DBUnitRule.apply(DBUnitRule.java:57)
...
Running parameterized tests is fine with version 1.2.9 but fails with all later versions including 1.3.0 and 1.4.0
You may refer to this test case for verification:
@RunWith(Parameterized.class)
@DBUnit(url = "jdbc:h2:mem:test", driver = "org.h2.Driver", user = "u", password = "p")
public class ParameterizedTest {
private int given;
private int expected;
@Rule
public final DBUnitRule dbUnitRule = DBUnitRule.instance();
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(
new Object[] {0,0},
new Object[] {1,1},
new Object[] {2,2}
);
}
public ParameterizedTest(int given, int expected) {
this.given = given;
this.expected = expected;
}
@Test
public void shouldJustRunMoreThanOneTime() {
Assertions.assertThat(given).isEqualTo(expected);
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:17 (9 by maintainers)
Top Results From Across the Web
Database Rider Documentation
DBUnit rule is responsible for reading @DataSet annotation and prepare the database for each test. And. The following dataset.
Read more >Working With SQL and Databases in Rider - YouTube
In this webinar, we'll show the basics of writing SQL queries and working with data in Rider. All described is also relevant to...
Read more >Cannot connect to a database | JetBrains Rider Documentation
Databases can work locally, on a server, or in the cloud. ... If you specify a port as a parameter for the telnet...
Read more >Problem with DBRider: NoSuchTableException "the table ...
When I use framework "database-rider" with my postgresql database for spring-boot application they don`t work properly.
Read more >Database Rider: How to improve your DB tests
This framework makes it easier to perform integration tests. What we will get with Database Rider that we won't get with the other...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It seems to be working perfectly @rmpestano, great job, thank you!
Hi again @victor-costa-avancee, I couldn’t run your sample because of database setup so I tried to reproduce on quarkus dbunit sample which uses CDI but It’s working there, can you have a look? https://github.com/database-rider/database-rider/blob/1bd24f0c5aa659cebf91b045afd601d67bdb7140/rider-examples/quarkus-dbunit-sample/src/test/java/com/github/quarkus/sample/QuarkusDBUnitParameterizedTest.java#L32-L59
I hope It helps