Questions tagged [junit3]

JUnit 3 is version 3 of the popular JUnit testing framework for Java

JUnit 3 is version 3 of the popular JUnit testing framework for Java.

Use this tag only for question related to features provided by version 3. Use for general questions.

152 questions
2
votes
1 answer

I want to execute few selected test cases from my class of multiple test cases using Junit3 with ease

As my 1-2 test cases are failing from bunch of test cases and also finding difficult to execute whole test suite again for these two, is there any method without adding comment to the others or copying these two methods in different suite. Thanks to…
user808548
2
votes
0 answers

Using junit under Android with Eclipse

I'm trying to use junit to test some classes I'm writing in a project. The problem is that I can't see any failure event if the test testNull is a assertEquals(new Integer(1), null). This is the output: 01-01 07:35:21.754: INFO/TestRunner(16093):…
Luca Carlon
  • 9,546
  • 13
  • 59
  • 91
2
votes
2 answers

JUnit testing layout

I have a specific dictionary project that takes in user inputs and writes them to a database. The inputs (for now) are taken in through scanners (System.in) and I have multiple cases for example: Enter word and definition Enter synonyms Print…
Armando Xhimanki
  • 115
  • 1
  • 11
2
votes
5 answers

Assert.assertEquals on two lists

I have a class MySchool: public class MySchool{ private long timestamp; private SchoolEvent event; private Object value; //getter & setters ... @Override public String toString() { return "MySchool [timestamp="…
user842225
  • 5,445
  • 15
  • 69
  • 119
2
votes
1 answer

How to print string messages using JUnit even if the test method is passing?

I want print string message for passed test cases. I am able to print message for failure cases using fail() method. How can I print message for pass cases? public class TestCaseTesting extends TestCase { @Test public void testFailTesting() { …
Pandey Praveen
  • 95
  • 1
  • 2
  • 12
2
votes
0 answers

Continue Test execution after Failing test (Android Junit 3)

Is it possible to continue Testexcution with Android testing Framework (JUNIT 3) after one single test* Method failed? Currently it stops the whole test execution and does not run further tests. I'd like it to: run test 1 successfully fail test…
Denny1989
  • 639
  • 1
  • 9
  • 15
2
votes
2 answers

Is it possible to change the value of a final field in Java for the purposes of testing?

I think I already know the answer to this one, but it can't hurt to ask. I have a class that handles requests to an external service. The class has a field that helps it stay within the service rate limit: public static final int…
Scutterman
  • 357
  • 2
  • 14
2
votes
2 answers

Not able to get data from request in Junit when action class implements ParameterAware

I need to write jUnit for Struts 2 action class.But action class is implementing ParameterAware interceptor which takes parameter map in HashMap and action class takes all request parameter from this hashmap Action Class: public class BrokerAction…
user3381610
  • 55
  • 1
  • 6
2
votes
1 answer

How to click on Switch in Android Junit Test?

I used the below code to checked and unchecked on Switch component of Android. How to checked-unchecked on Switch by touch utility in Android Junit Testing? // wait 2 seconds for the start of the activity final…
user2477865
  • 271
  • 1
  • 3
  • 12
2
votes
1 answer

Randomise the order of instrumentation tests

I'm wondering if it's possible to randomise the order in which instrumentation tests are run, i.e. those extending ActivityInstrumentationTestCase2. I tried following this blog post, but I can't work out how to tell the testing framework that I…
Nelson Wright
  • 506
  • 9
  • 18
2
votes
3 answers

Porting JUnit tests from 3.x to 4.x

We have a lot of old unit tests which were written with Junit 3.x. I am tasked with porting them to our JUnit 4.x coding standard, which among things, forbids the use of "extends TestCase". Some of the old tests have a call to super.setUp() which I…
glenneroo
  • 1,908
  • 5
  • 30
  • 49
2
votes
2 answers

Android unit testing framework that can interact with Google Maps API. Does one exist?

I am working with Google Maps on Android 4.0 and I would like to know: Is there a testing framework (or anything..) that can interact with the Google Maps API? What are the possibilities when interacting/testing with Google Maps on Android? Is it…
2
votes
2 answers

How to run a single method in a JUnit 4 test class?

I have looked at all the similar questions, but in my opinion, none of them give a solid answer to this. I have a test class (JUnit 4 but also interested in JUnit 3) and I want to run individual test methods from within those classes…
s16h
  • 4,647
  • 1
  • 21
  • 33
2
votes
0 answers

How to exclude methods from test coverage in EclEmma?

I am using EclEmma plugin for checking test coverage for maven project. It works, but it gives coverage results based on all the functions in the testing class. As there is some getter, setter and private functions are there, i want to exclude them…
Dipak
  • 6,532
  • 8
  • 63
  • 87
2
votes
2 answers

Should JUnit3 TestSuite really be used like this?

I couldn't recall how to use JUnit3 TestSuite and after some Googling found this public class MyTestsuite extends TestSuite { public static Test suite() { final TestSuite s = new TestSuite(); s.addTestSuite(Test1.class); …
maaartinus
  • 44,714
  • 32
  • 161
  • 320