JUNIT Testing [message #837819] |
Fri, 06 April 2012 06:11 |
Jeffson Jeffson Messages: 1 Registered: April 2012 |
Junior Member |
|
|
Hi,
Normally, a class, which extends the "TestCase" class has to contain a constructor, which takes a String. The String then has to contain the names of the test-methods in your "TestCase"-class, which you want Junit to execute. But in eclipse you either:
1. Don't use any constructor, but it nevertheless works fine and all test-methods are executed.
or
2. Use a constructor, which takes a String. But you don't have to instantiate the test-class and it nevertheless works, even though you don't pass any String, you just push the "execute" button and it all magically works..
Can someone explain that, please?
Best regards
|
|
|
Re: JUNIT Testing [message #869807 is a reply to message #837819] |
Fri, 04 May 2012 11:22 |
Dani Megert Messages: 3802 Registered: July 2009 |
Senior Member |
|
|
On 06.04.2012 08:11, Jeffson Jeffson wrote:
> Hi,
>
> Normally, a class, which extends the "TestCase" class has to contain a
> constructor, which takes a String. The String then has to contain the
> names of the test-methods in your "TestCase"-class, which you want
> Junit to execute. But in eclipse you either:
> 1. Don't use any constructor, but it nevertheless works fine and all
> test-methods are executed.
> or
> 2. Use a constructor, which takes a String. But you don't have to
> instantiate the test-class and it nevertheless works, even though you
> don't pass any String, you just push the "execute" button and it all
> magically works..
> Can someone explain that, please?
JUnit uses reflection to collect all public methods that start with
"test" and then executes them.
Dani
>
> Best regards
|
|
|
Powered by
FUDForum. Page generated in 0.03365 seconds