junit4

jsfunit with junit 4

Hi, We would like to test our web application (jsf 1.2, richfaces 3.3.3) with jsfunit. We are using junit 4.8.1 library for our unit tests. But jsfunit (1.2.0.Final) requires non existing class junit.runner.TestSuiteLoader. If i downgrade to junit 3.8, i can't use annotations in my Test classes any more. Is there a solution for it? Th...

How to dynamically add a test to test suite in JUnit 4?

Hi, I recently read (link text) about a way to statically add tests to test suite in JUnit 4? What about a dynamic way, i.e. how to add a test class if its name is known not earlier than at run-time, e.g. its name is read from XML file? ...

junit testing with mockobjects

we are planning to bring Junit testing into our project and we just realised that to do junit testing we need to create lot of mockobjects. Can anyone suggest me a good tool or framework that can create these mockobjects for the classes that i will be performing unit testing? ...

simplium vs. selenium4junit

Hi, what are the advantages / disadvantages of simplium vs. selenium4junit vs. plain JUnit to run JUnit tests with Selenium RC? Thanks! ...

JUnit 4 test suite problems

Hi, I have a problem with some JUnit 4 tests that I run with a test suite. If I run the tests individually they work with no problems but when run in a suite most of them, 90% of the test methods, fail with errors. What i noticed is that always the first tests works fine but the rest are failing. Another thing is that a few of the tests...

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! ...

jUnit 4 DirectorySuiteBuilder Equivalent

I'd like to know if there is something similar to junit-addons DirectorySuiteBuilder (documentation) that works with jUnit 4. Simply stated, I want to load every file name *Test.java in a directory and build a suite out of them. I realize that I can build a suite that runs every test in a directory using ant, but I would prefer to not ...

GridGain Junit Tests

I use gridgain to distribute junit tests to various nodes. http://www.gridgainsystems.com/wiki/display/GG15UG/JUnit4+-+Distributed+JUnit I want to handover some variables by the gridgain router (DirectedGridGainTestRouter). I tried to set static values within the DirectedGridGainTestRouter but the nodes seems not to share initalized s...

Running particular named junit 4.8 tests in intellij

I am using junit 4.8 and intellij 8 and i would like to only run tests inside the IDE which are named something like *UnitTest.java. How can this be achieved? ...

Java/ JUnit - AssertTrue vs AssertFalse

Hello all, I'm pretty new to Java and am following the Eclipse Total Beginner's Tutorials. They are all very helpful, but in Lesson 12, he uses assertTrue for one test case and assertFalse for another. Here's the code: // Check the book out to p1 (Thomas) // Check to see that the book was successfully checked out to p1 (Thomas) assertT...

How do I Dynamically create a Test Suite in JUnit 4?

I would like to create a junit test suite using JUnit 4 where the names of the test classes to be included are not known until the test suite is run. In JUnit 3 I could do this: public final class MasterTester extends TestCase { /** * Used by junit to specify what TestCases to run. * * @return a suite containing what TestCa...

Selenium SeleniumTestCase .checkForVerificationErrors method : output status before it fails

Hi I am testing a table on a webpage where i need to verify all values in table. For this i have written a for loop something like this for (row) { for (column) { SeleniumTestCase.verifyTrue( "expected".equals("obtained")); } SeleniumTestCase.checkForVerificationErrors(); } Here in the fifth line i am checking was th...

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 ...

Using Junit 4's Timeout @Rule with Spring's AbstractTransactionalJUnit4SpringContextTests

When i use Junit's org.junit.rules.Timeout with spring's base class AbstractTransactionalJUnit4SpringContextTests, i get this exception: org.springframework.dao.InvalidDataAccessApiUsageException: no transaction is in progress; nested exception is javax.persistence.TransactionRequiredException: no transaction is in progress The log ou...

How do I delete all JPA entities?

Hello, In my testing code I need to have a blank/empty database at each method. Is there code that would achieve that, to call in the @Before of the test? ...

Junit @Before annotation is giving a Nullpointer exception

I am using junit 4.8.1. The following is the code. I am getting "Nullponiter" exception. I suspect that the "SetUp" code under @Before is not been excecuted before other methods. Request the learned friends to help me in resolving the issue. (This is an example for TDD book by Koskela) import org.junit.*; import java.util.*; import sta...

JBoss Arquillian integration with Apache Ant and Junit

Has anyone managed to integrate Arquillian with Ant and JUnit? If so, could you provide an example? ...

junit test case transaction not getting committed - no errors

Hi, We have implemented JUnit4 in our application which uses Spring core & JPA with DB2. We need to test a full functionality which retrieves data from one database and merges into another database. Test case for retrieving the data from 1st database is written and it is running without any error perfectly but the records are not st...

good practice to write junit test

hello, i'm not really familiar with junit4, so what are the good practice to write a gui test that verify some actions in the GUI. write the methode in Methode.java then write the testmethdoe in TestMethode.java? could you give me an example please ? thanks, ...

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...