Comments (5)
To add some context:
JUnit 5 adds support for an arbitrary amount of @Nested
tests. Currently, the Flyway migration scripts will only run for direct members of the annotated class:
@FlywayTest(...)
class Test {
@Test
public void test1() { ... } // ✔︎
@Nested
public class Nested1 {
@Test
public void test2() { ... } // ✘
}
@Nested
@FlywayTest(...)
public class Nested2 {
@Test
public void test3() { ... } // ✔︎
}
}
I would expect nested test classes to inherit the behaviour from their parent. That said, it should be possible to overwrite behaviour in nested classes (i.e. setting clean = false
for nested class that has an @Order
ed sequence of tests).
There may be one difficult edge case, though: If a parent class is annotated with clean = false
, all descendant tests are inherently stateful. However, if a @Nested class
now decides to use clean = true
, it resets the parent's state. In other words: We either need a mechanism to make a copy of the parent's state ("clone the database") or need to document that behaviour is unspecified in this scenario.
Vice versa (parent cleans, nested doesn't) shouldn't be a problem, though.
from flyway-junit5-extensions.
Thanks. I'll have a look.
from flyway-junit5-extensions.
@overheadhunter any chance for you to try out #147?
The @FlywayTest
behaviour is always a merge of all metadata across the hierarchy (or enclosing class).
For instance, if a parent class is annotated with clean = false
, all nested classes also inherit the same behaviour. If a nested class overrides clean = true
, it applies only in the context of that nested class.
from flyway-junit5-extensions.
On first glance that seems to work. 🙌
However, Quarkus is giving me a hard time testing multiple levels of nested tests. So I can not really verify this case.
from flyway-junit5-extensions.
Ok, thanks. I'll do a release as is, and then we will try to figure out on the Quarkus side.
from flyway-junit5-extensions.
Related Issues (10)
- README.md outdated HOT 1
- How to use this extension with a database managed by Quarks Dev Services HOT 5
- Update readme.md with correct maven artifactId HOT 1
- `flyway.locations` not respected HOT 1
- flywaydb JdbcUtils can't connect to H2 HOT 6
- [Quarkus] How to use with postgres Docker devservices?
- Define schema HOT 1
- A way to pass arbitrary flyway config to @FlywayTest HOT 3
- Quarkus native test HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flyway-junit5-extensions.