You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Chris Luff <ch...@oracle.com> on 2023/02/16 10:22:21 UTC

Junit5 @Nested

Hey all, I encountered a project using the @Nested annotation for test classes;

class ProjectTests {
	@Nested
	class HappyPath {
		@Test
		void test_this_happy() {
			System.out.println(“Happiness);
		}
	}
	@Nested
	class SadPath {
		@Test
		void test_this_sad() {
			System.out.println(“Sadness);
		}
	}
}

I was attempting to debug one of the nested tests and noted that nothing is executed. I have the surefire config;

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude/>
                    </excludes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.junit.jupiter</groupId>
                        <artifactId>junit-jupiter-engine</artifactId>
                        <version>${junit.jupiter.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            
NetBeans is executing;
	mvn -Dtest=com.cerner.ukdev.mars.dataaccess.ProjectTests#test_this_happy -Pdevelopment process-test-classes surefire:test
	
This means the test is not found. On the command line I can run;
	mvn -Dtest=com.cerner.ukdev.mars.dataaccess.ProjectTests\$HappyPath#test_this_happy -Pdevelopment process-test-classes surefire:test
	
I saw this PR[1] from some time ago but it looks to have been abandoned. Was there any other work on this or should I have a look at getting this working? From a surefire pov it looks to simply be a case of class scanning for the nested annotation and ensuring the inner class is inserted into the command?

Thoughts welcome.
Chris

[1]: https://github.com/apache/netbeans/pull/1069

Re: [External] : Re: Junit5 @Nested

Posted by Chris Luff <ch...@oracle.com>.
Cool, I’ll have a look and see what can be done.

> On 17 Feb 2023, at 20:13, Michael Bien <mb...@gmail.com> wrote:
> 
> Hi Chris,
> 
> On 16.02.23 11:22, Chris Luff wrote:
>> 	
>> I saw this PR[1] from some time ago but it looks to have been abandoned. Was there any other work on this or should I have a look at getting this working?
> 
> I am not sure, but since it isn't working as intended I would guess that there wasn't any follow up after this closed PR from 2019.
> 
> jira issue is also still open: https://urldefense.com/v3/__https://issues.apache.org/jira/browse/NETBEANS-1744__;!!ACWV5N9M2RV99hQ!JY3vpzSMl1gn_Ob6rraBammIS9nAkYarHf-zieiyZnLTqf5UELt4odQYBB2Wtalkduc-EmRYJh2vpObJ$ 
> 
>>  From a surefire pov it looks to simply be a case of class scanning for the nested annotation and ensuring the inner class is inserted into the command?
> 
> If you think you have a way of fixing it - sure! It makes sense to me at least :)
> 
> best regards,
> 
> michael
> 
>> 
>> Thoughts welcome.
>> Chris
>> 
>> [1]: https://urldefense.com/v3/__https://github.com/apache/netbeans/pull/1069__;!!ACWV5N9M2RV99hQ!JY3vpzSMl1gn_Ob6rraBammIS9nAkYarHf-zieiyZnLTqf5UELt4odQYBB2Wtalkduc-EmRYJgbtlKoV$ ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
>> For additional commands, e-mail: dev-help@netbeans.apache.org
>> 
>> For further information about the NetBeans mailing lists, visit:
>> https://urldefense.com/v3/__https://cwiki.apache.org/confluence/display/NETBEANS/Mailing*lists__;Kw!!ACWV5N9M2RV99hQ!JY3vpzSMl1gn_Ob6rraBammIS9nAkYarHf-zieiyZnLTqf5UELt4odQYBB2Wtalkduc-EmRYJpoCRWGw$ 
>> 
>> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Junit5 @Nested

Posted by Michael Bien <mb...@gmail.com>.
Hi Chris,

On 16.02.23 11:22, Chris Luff wrote:
> 	
> I saw this PR[1] from some time ago but it looks to have been abandoned. Was there any other work on this or should I have a look at getting this working?

I am not sure, but since it isn't working as intended I would guess that 
there wasn't any follow up after this closed PR from 2019.

jira issue is also still open: 
https://issues.apache.org/jira/browse/NETBEANS-1744


>   From a surefire pov it looks to simply be a case of class scanning for the nested annotation and ensuring the inner class is inserted into the command?

If you think you have a way of fixing it - sure! It makes sense to me at 
least :)

best regards,

michael

>
> Thoughts welcome.
> Chris
>
> [1]: https://github.com/apache/netbeans/pull/1069
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists