Bug 181508 - [patch]Test framework cannot run tests provided by a fragment
Summary: [patch]Test framework cannot run tests provided by a fragment
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Releng (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-Releng-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-04-07 20:54 EDT by Philippe Ombredanne CLA
Modified: 2013-04-25 21:12 EDT (History)
4 users (show)

See Also:


Attachments
Fragment support based Eclipse 3.2.2 release (2.78 KB, patch)
2007-04-08 03:56 EDT, Philippe Ombredanne CLA
no flags Details | Diff
Fragment support based HEAD release (2.43 KB, patch)
2007-04-08 03:57 EDT, Philippe Ombredanne CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Ombredanne CLA 2007-04-07 20:54:58 EDT
An setup I use is to have unit tests in a fragment, whose host is the bundle under test.
It has the benefit of giving you full access to package and protected things, even if not exported by the host while keeping the tests tidy in a separate bundle.

However, the test framework assumes that the bundleid you pass it is a host, and knows nothing about it being a fragment.

A simple workaround is to invoke the test script in the fragment but to pass the id of the host plugin, which is weid.

I'll try to submit a patch.
Comment 1 Philippe Ombredanne CLA 2007-04-08 03:56:38 EDT
Created attachment 63224 [details]
Fragment support based Eclipse 3.2.2 release
Comment 2 Philippe Ombredanne CLA 2007-04-08 03:57:17 EDT
Created attachment 63225 [details]
Fragment support based HEAD release
Comment 3 Philippe Ombredanne CLA 2007-04-08 03:59:09 EDT
The attached patches check if the plugin is a fragment or host.
If this is a fragment, the host bundle is found, and used instead to load classes.
Without that patch, the current implementation fails to loads tests when they are provided in a fragment. 
Comment 4 Philippe Ombredanne CLA 2007-04-17 01:12:59 EDT
Any chances to look at that? or after 33?
Comment 5 Sonia Dimitrov CLA 2007-04-24 16:25:53 EDT
Patch for the HEAD stream has been applied.  Will test in nightly build.  Will require approval from PMC for 3.2.x stream.
Comment 6 Patrick Paulin CLA 2008-08-18 13:14:31 EDT
I'm now encountering this issue for the first time running 3.4. I had no problems running fragment tests in 3.3, probably because of this patch. 

I'm wondering if I should submit a new bug report for this in 3.4 or if it's related to what's already been done here.

Thanks,

--- Patrick

Comment 7 Patrick Paulin CLA 2009-11-06 12:32:26 EST
I wanted to revisit this entry because I recently attempted to run fragment based unit tests with the Eclipse Test Framework under 3.5.1. The tests in the fragment still cannot be found. BTW, I'm putting the id of the host plugin in the core-test target, but I've tried the fragment id as well.

Is anyone able to run fragment based unit tests using the ETF? Am I doing something wrong?

Thanks,

--- Patrick
Comment 8 Kim Moir CLA 2009-11-06 15:50:07 EST
I don't know that this would work in 3.5.  I personally don't have any any fragment test bundles.  Does anyone else on the bug run tests on fragments in the 3.5.x stream?
Comment 9 David Williams CLA 2013-04-25 21:12:01 EDT
I'm going to mark this as "won't fix", because a) its so old, and b) I think with OSGi and our test framework, there is no way to "invoke" tests on a fragment. In a sense, by the time bundles are loaded, the fragment "becomes part of the host bundle". But, I've heard of people doing similar things using the "normal" JUnit support with annotations in the fragment to identify classes/methods as tests. 

I'm perfectly willing to reconsider if you still think this possible, but ... you'll have to try and provide current patches for 4.x stream to be considered. 

Thanks, though, for reporting. I'm just trying to clean up "old bugs".