Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider declaring class for Enclosed tests in Categories #1663

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jwgmeligmeyling
Copy link

At QueryDSL, we were surprised that Enclosed tests were not run when the category was included as group filter.

It turns out to be because the declaring class is not considered when determining the categories for a particular test. This pull request changes that behaviour to also consider the declaring class.

Example:

@Category(H2.class)
public class H2LiteralsSuiteTest extends AbstractSuite {

    public static class BeanPopulation extends BeanPopulationBase { }
    public static class Delete extends DeleteBase { }
    public static class Insert extends InsertBase { }
    public static class KeywordQuoting extends KeywordQuotingBase { }
    public static class LikeEscape extends LikeEscapeBase { }

Where AbstractSuite is annotated with @RunWith(Enclosed.class).

When <groups>com.querydsl.core.testutil.H2</groups> is used, none of the inner test classes is executed, unless they themselves are annotated with @Category(H2.class). To us it would make sense that this is implicit.

Source: https://github.com/querydsl/querydsl/blob/master/querydsl-sql/src/test/java/com/querydsl/sql/suites/H2LiteralsSuiteTest.java#L9-L16

At QueryDSL, we were surprised that Enclosed tests were not run when the
category was included as group filter. It turns out to be because the
declaring class is not considered when determining the categories for a
particular test. This pull request changes that behaviour to also
consider the declaring class.

Example:

```java
@category(H2.class)
public class H2LiteralsSuiteTest extends AbstractSuite {

    public static class BeanPopulation extends BeanPopulationBase { }
        public static class Delete extends DeleteBase { }
	    public static class Insert extends InsertBase { }
	        public static class KeywordQuoting extends
		KeywordQuotingBase { }
		    public static class LikeEscape extends
		    LikeEscapeBase { }
```

Source: https://github.com/querydsl/querydsl/blob/master/querydsl-sql/src/test/java/com/querydsl/sql/suites/H2LiteralsSuiteTest.java#L9-L16
@marcphilipp marcphilipp changed the base branch from master to main June 21, 2020 17:05
johnktims added a commit to johnktims/querydsl that referenced this pull request Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants