I came to use JUnit for testing purpose. This is the first time I am using JUnit.
I have one doubt. In the code for testing, do all methods in the TestClass get executed without any explicit call to them?
In one of the tests, the TestClass had some 6 methods (name starting with 'test...', I guess this is just convention). Since there was no explicit call made to any of these methods, its my guess that JUnit framework will execute all.
You can execute JUnit test processes from a command-line or when using an IDE, you can execute from within the IDE.
In both cases, you are executing a test driver which then makes the explicit calls on the test class. The driver is written to explicitly call all of the methods identified with the @Test annotation.
Joined: Dec 05, 2006
In my testClass I had 2 test methods: testGetProductList and testSaveProduct.
I tried running the tests through ant build after removing the 'test' from the names of these methods, and I got this:
[junit] Testcase: warning(junit.framework.TestSuite$1): FAILED
[junit] No tests found in springapp.repository.JdbcProductDaoTests
[junit] junit.framework.AssertionFailedError: No tests found in springapp.repository.JdbcProductDaoTests
And originally, i was thinking that this 'test' thing is just a convention (case sensitive!!!).
In JUnit 3, all public void methods without arguments that start with the "test" prefix are executed as tests.
In JUnit 4, while that old style still is supported, you typically use the @Test annotation to denote test methods.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus