Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Test and Performance Tools Platform (TPTP) » Can TPTP be used to generate JUnit stubs for interfaces and abstract classes?
Can TPTP be used to generate JUnit stubs for interfaces and abstract classes? [message #20378] Tue, 28 June 2005 11:42 Go to next message
Christophe Cornu is currently offline Christophe Cornu
Messages: 304
Registered: July 2009
Senior Member
Hi,

I have questions regarding TPTP and JUnit testing support.

1. Can TPTP be used to generate JUnit tests stubs for each API method in
my project?
2. Does TPTP provide some support to test Java interfaces and abstract
classes?
3. Can TPTP update the test stubs whenever the API methods in my project
are renamed/added/removed?

Thanks a lot,

Chris
Re: Can TPTP be used to generate JUnit stubs for interfaces and abstract classes? [message #20431 is a reply to message #20378] Wed, 29 June 2005 02:14 Go to previous messageGo to next message
No real name is currently offline No real name
Messages: 11
Registered: July 2009
Junior Member
See below for answers to your questions.

Thanks for your interest in the TPTP project.


"Christophe Cornu" <christophe_cornu@ca.ibm.com> wrote in message
news:6148e1644014111932a933e41224b7d0$1@www.eclipse.org...
> Hi,
>
> I have questions regarding TPTP and JUnit testing support.
>
> 1. Can TPTP be used to generate JUnit tests stubs for each API method in
> my project?
When creating a TPTP JUnit test suite, the wizard doesn't associate the
suite with any particular class. The user is required to add each test API
using the "Test Methdods" page under the test suite editor. See Help > Help
Contents > TPTP Tester guide > JUnit testing with TPPT > Creating JUnit
tests > Creating a JUnit test manually for more details.
Once the test methods are added, the Java source code is automatically
generated.

> 2. Does TPTP provide some support to test Java interfaces and abstract
> classes?
I'm not clear about how you intend to test a Java interface/abstract class.
JUnit test cases are designed to test specific methods that have already
been implemented by clients. Can you elaborate on what type of testing you
wish to perform on your interfaces/abstract classes. I'm interested to hear
your ideas.

> 3. Can TPTP update the test stubs whenever the API methods in my project
> are renamed/added/removed?
Since a JUnit test suite is not associated with a particular class, then a
dynamic update of test methods (when Java source code under test is changed)
is currently not done. But this is an interesting enhancement that you can
open against the test component if you wish us to follow upon it.
We do of course change the name of each test method in the JUnit stub code
if it is changed in the test suite editor.

>
> Thanks a lot,
>
> Chris
>
Re: Can TPTP be used to generate JUnit stubs for interfaces and abstract classes? [message #21100 is a reply to message #20431] Thu, 30 June 2005 16:05 Go to previous message
Christophe Cornu is currently offline Christophe Cornu
Messages: 304
Registered: July 2009
Senior Member
Thanks for your response, Ali.

> I'm not clear about how you intend to test a Java interface/abstract class.

At the moment, each project seems to implement their own little framework
to go around this. JUnitDoclet 2.0 might provide a more standard solution
in the future:

http://www.junitdoclet.org/2005/04/000166.html
The new release will be able to generate abstract TestCases for interfaces
and abstract classes. Those tests will be applied to all instanciable
classes implementing the interfaces / deriving from these abstract
classes.
How about reusing test cases? Liskov Substitution Principle says, a class
B derived from class A should behave as class A, too. Applying the tests
from ATest on B would verify that. Because these additional test cases can
be generated without manual interference, one will get even more out of
exisiting test cases.

The problem is also described in this article.
http://www.ddj.com/documents/s=1679/ddj0302b/

Cheers,

Chris
Previous Topic:JVM crashes while running TPTP 4.0 on Eclipse 3.1RC3 (JRE 1.4.2)
Next Topic:funny
Goto Forum:
  


Current Time: Thu Aug 21 12:09:34 EDT 2014

Powered by FUDForum. Page generated in 0.06169 seconds