Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » JUnit and iterative development (traceability)
JUnit and iterative development (traceability) [message #309186] Wed, 18 October 2006 02:08 Go to next message
Eclipse UserFriend
Originally posted by: christopher.fuhrman.etsmtl.ca

Hi,

I'm searching for a way to automatically synchronize a JUnit test class
with its target class in Eclipse, as the target class evolves iteratively.

The Test case wizard works great the first time you create a test class.
However, it seems to be a manual operation from then on to keep your
test class up to date with the target class, as you add methods or
refactor.

Intuitively, I would expect it to be in the Source right-click menu of
the Java editor, much like "Generate Getters and Setters..." works, only
for the missing test methods. I couldn't find any discussion in the
documentation or the web, but I've not yet upgraded to 3.2 of Eclipse
(so I apologize if this feature is now in 3.2).

Are there any tools that identify the methods that are not covered by a
JUnit test class? PMD has some basic checks for JUnit style errors, but
I'm looking for something that comes closer to doing traceability.

Thanks in advance,

Cris

--
Prof. Christopher Fuhrman
Department of Software and IT Engineering
University of Quebec - École de technologie supérieure (ETS)
http://profs.logti.etsmtl.ca/cfuhrman/index.shtml?en
+1 (514) 396 8638
Re: JUnit and iterative development (traceability) [message #309205 is a reply to message #309186] Wed, 18 October 2006 13:52 Go to previous messageGo to next message
Patrick Paulin is currently offline Patrick PaulinFriend
Messages: 42
Registered: July 2009
Member
Hi Chris,

I agree that something like this would be useful. I'm not aware of
anything, but maybe someone else has more information.

I did want to say, though, that practicing test-driven development is one
solution. Say you write a test that calls a new method foo(). Because that
method does not exist yet, you'll obviously have a compile error. But
you'll also be able to utilize the Quick Fix suggestion to create the
method. If you develop this way, your test cases will always be in synch
with your code and you'll eliminate a lot of typing.

--- Patrick

Christopher Fuhrman wrote:

> Hi,

> I'm searching for a way to automatically synchronize a JUnit test class
> with its target class in Eclipse, as the target class evolves iteratively.

> The Test case wizard works great the first time you create a test class.
> However, it seems to be a manual operation from then on to keep your
> test class up to date with the target class, as you add methods or
> refactor.

> Intuitively, I would expect it to be in the Source right-click menu of
> the Java editor, much like "Generate Getters and Setters..." works, only
> for the missing test methods. I couldn't find any discussion in the
> documentation or the web, but I've not yet upgraded to 3.2 of Eclipse
> (so I apologize if this feature is now in 3.2).

> Are there any tools that identify the methods that are not covered by a
> JUnit test class? PMD has some basic checks for JUnit style errors, but
> I'm looking for something that comes closer to doing traceability.

> Thanks in advance,

> Cris
Re: JUnit and iterative development (traceability) [message #309206 is a reply to message #309205] Wed, 18 October 2006 14:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christopher.fuhrman.etsmtl.ca

Patrick Paulin wrote:
> I did want to say, though, that practicing test-driven development is
> one solution. Say you write a test that calls a new method foo().
> Because that method does not exist yet, you'll obviously have a compile
> error. But you'll also be able to utilize the Quick Fix suggestion to
> create the method. If you develop this way, your test cases will always
> be in synch with your code and you'll eliminate a lot of typing.

Very good point. With this philosophy, I can see why such a
synchronization functionality would be less needed. I guess it's all
about breaking old habits.

--
Prof. Christopher Fuhrman
Department of Software and IT Engineering
University of Quebec - École de technologie supérieure (ETS)
http://profs.logti.etsmtl.ca/cfuhrman/index.shtml?en
+1 (514) 396 8638
Re: JUnit and iterative development (traceability) [message #309222 is a reply to message #309205] Wed, 18 October 2006 22:53 Go to previous message
Eclipse UserFriend
Originally posted by: christopher.fuhrman.etsmtl.ca

Patrick Paulin wrote:
> Say you write a test that calls a new method foo().

I found a feature close to what I was looking for. When creating the
test for the method foo(), if you type the word "test" (without quotes)
and press Ctrl-Space, you can choose a template for a test method. Your
cursor is positioned to replace the text "name" in the following:

public void testname() {

}

Then it's just a matter of typing Foo (and then writing the test, and
then creating/writing the method foo()).

--
Prof. Christopher Fuhrman
Department of Software and IT Engineering
University of Quebec - École de technologie supérieure (ETS)
http://profs.logti.etsmtl.ca/cfuhrman/index.shtml?en
+1 (514) 396 8638
Previous Topic:Property view (own popup to viewer)
Next Topic:"Help Contents" suffering issue
Goto Forum:
  


Current Time: Wed Sep 25 23:09:28 GMT 2024

Powered by FUDForum. Page generated in 0.03845 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top