Bug 264521 - [fiximprove] [unittestsupport]: Disabling JMUnit causes confusion
Summary: [fiximprove] [unittestsupport]: Disabling JMUnit causes confusion
Status: CLOSED FIXED
Alias: None
Product: MTJ (Archived)
Classification: Tools
Component: UI (show other bugs)
Version: 0.9.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 1.0.1   Edit
Assignee: David Marques CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks: 285705
  Show dependency tree
 
Reported: 2009-02-11 09:33 EST by Gorkem Ercan CLA
Modified: 2009-10-28 08:47 EDT (History)
7 users (show)

See Also:


Attachments
Patch to fix the confusion when disabling JMUnit (14.20 KB, patch)
2009-08-21 14:56 EDT, Eric Sousa Dias CLA
wtv368: iplog+
wtv368: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gorkem Ercan CLA 2009-02-11 09:33:54 EST
Selecting "Disable JMUnit" in turn causes filters for *Test and *TestSuite names to be added to the source folder. This is confusing if you have some java files that includes "Test" as part of their name  but not using JMUnit.
Perhaps the filter can be done so that only files depending on JMUnit is added to the filter.
Comment 1 Gustavo de Paula CLA 2009-04-02 12:26:16 EDT
currently we don't have enought engineers to work on this on 1.0 timeframe. i1m postponing this to a future release
Comment 2 David Aragão CLA 2009-08-04 13:46:19 EDT
Proposed Solution

Hello everyone,

Rather than excluding the classes in the source folders with name ending in "Test", exclude the classes that extends of "TestCase" or "TestSuite". To do so, when enable the JMUnit, scan the workspace by classes that extends "Test" or "TestSuite" and add them to the exclusion filters. Also add an IResourceChangeListener that will be looking for test classes modifications in the workspace in order to update the exclusion filters. When disabling JMUnit all exclusion filters will be cleaned and the workspace listener will be removed.

Please, feel free to make suggestions!

David Aragao

Comment 3 Diego Madruga Sandin CLA 2009-08-06 16:24:59 EDT
I like the idea. For me it's good enough. The only thing you must remember is to check the hole hierarchy of the class. I.e. class A extends Class B that Extends TestCase

Could you provide a patch with the implementation of this solution?

Thanks
Diego
Comment 4 David Marques CLA 2009-08-06 16:28:00 EDT
+1 for the proposed solution implemetation!

(In reply to comment #2)
> Proposed Solution
> 
> Hello everyone,
> 
> Rather than excluding the classes in the source folders with name ending in
> "Test", exclude the classes that extends of "TestCase" or "TestSuite". To do
> so, when enable the JMUnit, scan the workspace by classes that extends "Test"
> or "TestSuite" and add them to the exclusion filters. Also add an
> IResourceChangeListener that will be looking for test classes modifications in
> the workspace in order to update the exclusion filters. When disabling JMUnit
> all exclusion filters will be cleaned and the workspace listener will be
> removed.
> 
> Please, feel free to make suggestions!
> 
> David Aragao
> 

Comment 5 Craig Setera CLA 2009-08-09 19:38:05 EDT
Maybe I'm missing something... why are we mixing test case classes into the same source folder as the real source?  Shouldn't they be in a different source folder?
Comment 6 David Aragão CLA 2009-08-10 15:06:36 EDT
The user can choose where to put the test classes, then it is a user's decision put in the same folder or not. The solution will work in both cases.

Regards,

David Aragão 
Comment 7 Craig Setera CLA 2009-08-11 21:01:10 EDT
I'm OK with the solution, but I do think we should be directing users to put their test cases into a separate source folder.
Comment 8 Diego Madruga Sandin CLA 2009-08-11 21:28:13 EDT
(In reply to comment #7)
> I'm OK with the solution, but I do think we should be directing users to put
> their test cases into a separate source folder.
> 

I agree. Maybe we could set the default source folder on the "New Test Case wizard" to test. if the user wants, this folder can be changed.
Comment 9 Eric Sousa Dias CLA 2009-08-18 08:02:59 EDT
Hello everyone,

I will fix this bug and send a patch soon.

Regards,

Eric Sousa Dias
Comment 10 Eric Sousa Dias CLA 2009-08-21 14:56:25 EDT
Created attachment 145309 [details]
Patch to fix the confusion when disabling JMUnit

Hello all,

This patch proposes to fix the disabling JMUnit problem.

The idea proposed by Craig (directing users to put their test cases into a separate source folder) can be created in another bug for improvement.

Can anyone revise this patch?

Eric Sousa Dias
Comment 11 David Marques CLA 2009-08-22 15:37:50 EDT
Patch reviewed and code committed.
Comment 12 Eric Sousa Dias CLA 2009-08-24 09:52:16 EDT
I, Eric Sousa Dias have created the patch attachment 145309 [details] solely based on existing (EPL licensed) code in the MTJ project, and wrote all new code 100% myself, without using any other open source or proprietary source code as a
basis for my work.

   I am making my contribution available under the terms of the Eclipse Public
License (EPL) to be included in the codebase of the MTJ project.
Comment 13 Diego Madruga Sandin CLA 2009-10-28 08:47:08 EDT
Released