junit3

Mocking inside a Java class

So I have this GWT code that handles RPC requests maintain states(ready, waiting, error etc). And I would like to check if the class change its states correctly after each call, set response variables etc. Now how should I proceed to test that without making actual requests to the server(that could run into errors in the server it self)...

Maven 2 Not Running Junit 4 Tests

Hello, I'm having an issue getting surefire to run Junit4 tests. This same issue was reported in http://stackoverflow.com/questions/2021771?sort=newest#sort-top but the solution there was to removed the offending dependency whose transitive dependency caused the inclusion of junit3. In my case the dependency is necessary. I'm trying to f...

Junit Dynamically Created Tests Not Working

Hey, so heres my code: public class NewTest extends SeleneseTestCase { public static Test suite() throws Exception { TestSuite suite = new TestSuite(); TestSuite s = new TestSuite("TestCase Name"); GeneratedTest t = new GeneratedTest("testName"); t.setFailure("TestCase Name: testName"); s.addTest(t); t = ...

JUnit Exception Testing

Edit: Not JUnit 4 available at this time. Hi there, I have a question about "smart" exception testing with JUnit. At this time, I do it like this: public void testGet() { SoundFileManager sfm = new SoundFileManager(); // Test adding a sound file and then getting it by id and name. try { SoundFile add...

Specifying an order to junit 4 tests at the Method level (not class level)

I know this is bad practice, but it needs to be done, or I'll need to switch to testng. Is there a way, similar to JUnit 3's testSuite, to specify the order of the tests to be run in a class? Thanks for the help! ...

JUnit3 and Junit4 XML Reports with Maven

I am trying to figure out how to use the supposed reporting capabilities of JUnit (3 and 4) in conjunction with Maven, but Google searches aren't turning up much in the way of how to actually run JUnit (via Maven), get a report for each test (or all tests) and what format it will be in. So, my multi-part questions is: 1.) What sort of ...

setUp/tearDown (@Before/@After) why we need them in JUnit?

Hi All, I believe that we are all know that setUp (@Before) will execute before any test method and tearDown(@After) will execute after test method. Also we know that Junit will create one instance of Test per test method. my question is that can we just move setUp method content to class Constructor and remove setUp method? is the...

Junit 3 to JUnit 4 conversion

I had the following version of a test in JUnit 3, and I tried converting it into JUnit 4, with no success. The idea is to have a base test case, that does the actual test of an interface, say Service interface. I want to test the ServiceImpl class, using the base test case. public abstract class ServiceBaseTest extends TestCase { p...

jUnit testing Database operations.

Hello. I'm developing an Android application with database storage. I want to test some classes that I use to access database. I've found ActivityInstrumentationTestCase2 to test Activities but I haven't found anything to test classes. How can I do that? I haven't used jUnit before. Thanks. ...

How can I have the Ant JUnit task run all tests and then stop the rest of the build if any test has failed.

I'm running JUnit via Ant using a target something like this: <target name="junit" depends="compile"> <mkdir dir="${report.dir}"/> <junit printsummary="yes" haltonfailure="yes" showoutput="yes" > <classpath> <path refid="classpath"/> <path location="${classes.dir}"/> </classpath> <...