Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 572520

Summary: Run As > JUnit Plugin Test fails if the test is in a source-folder marked as 'includes test sources'
Product: [Eclipse Project] PDE Reporter: Christoph Laeubrich <laeubi>
Component: UIAssignee: Christoph Laeubrich <laeubi>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: julian.honnen, mistria, register.eclipse, Vikas.Chandra
Version: 4.18   
Target Milestone: 4.20 M2   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/c/pde/eclipse.pde.ui/+/178783
https://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=b5ca52322cdb7c91b49fca35800a2f3e21705a18
Whiteboard:
Bug Depends on:    
Bug Blocks: 572627, 572743    
Attachments:
Description Flags
Example project none

Description Christoph Laeubrich CLA 2021-04-01 05:51:10 EDT
1) create a plugin project
2) create a new source folder, mark it as a "test" sources folder
3) create a JUnit4 Test
4) Run As > JUnit Test  --> Works
5) Run As > JUnit Plugin Test  --> Class not found <name of test class>
Comment 1 Vikas Chandra CLA 2021-04-01 07:24:40 EDT
source.. = src/,\
           test/   <-------ADD TEST FOLDER 


Adding test as src in build.properties should work. Can you check

I think PDE compiler should output this warning even if the src folder is a test folder.
Comment 2 Christoph Laeubrich CLA 2021-04-01 07:27:06 EDT
(In reply to Vikas Chandra from comment #1)
> Adding test as src in build.properties should work.

This would work but contradicts the whole idea of "test" source folders. These should not be part of the final artifact but only be on the "test-classpath".
Comment 3 Vikas Chandra CLA 2021-04-01 08:06:18 EDT
(In reply to Christoph Laeubrich from comment #2)
> (In reply to Vikas Chandra from comment #1)
> > Adding test as src in build.properties should work.
> 
> This would work but contradicts the whole idea of "test" source folders.
> These should not be part of the final artifact but only be on the
> "test-classpath".

I tried on 4.12 and it doesnt work there. I dont think this scenario ever worked since the test folders were introduced in 4.8.
Comment 4 Christoph Laeubrich CLA 2021-04-01 08:24:43 EDT
(In reply to Vikas Chandra from comment #3)
> I tried on 4.12 and it doesnt work there. I dont think this scenario ever
> worked since the test folders were introduced in 4.8.

I also assume that this never was tested before. I'm currently adding support for this to tycho and it would thus be good if PDE supports this too.
Comment 5 Christoph Laeubrich CLA 2021-04-02 07:15:40 EDT
I'll take a look into this.
Comment 6 Eclipse Genie CLA 2021-04-02 09:29:12 EDT
New Gerrit change created: https://git.eclipse.org/r/c/pde/eclipse.pde.ui/+/178783
Comment 7 Christoph Laeubrich CLA 2021-04-13 13:19:30 EDT
Created attachment 286094 [details]
Example project
Comment 8 Christoph Laeubrich CLA 2021-04-13 13:21:54 EDT
The PR is now ready for review, I attached an example that fails before but succeeds after applying the patch.
Comment 10 Vikas Chandra CLA 2021-05-17 10:31:43 EDT
Christoph , can you verify this fix ?