junit

RCP unit-tests via fragment delays any view to be shown after all test are finished

hi, I have strange problem using fragment with tests for my plug-in. all I do in the test is initialize the view in set-up and then in test I wait 20 second (with Thread.sleep). the result is that my application (view) never show until the test finish. can I do something about it? this is just an example, my test are about testing ui ...

Need help with writing test

I'm trying to write a test for this class its called Receiver : public void get(People person) { if(null != person) { LOG.info("Person with ID " + person.getId() + " received"); processor.process(person); }else{ LOG.info("Person not received abort!"); ...

java.lang.NoClassDefFoundError while running JUnit test in Netbeans

I am building an Android hello world application in Netbeans. It's building properly and I am able to run in the emulator also. But when creating and running the Junit test I get a java.lang.NoClassDefFoundError. How can I fix this problem? ...

Exception while allowingTestExecutionListener for JUnit test under Spring

Hi. I have two JUnit tests. Separately,under Eclipse,they ran OK. In case they were ran by mvn clean install command separately (one of the test was disabled),that all were OK also. When both tests are enabled, that mvn clean install failed with stack: 18:37:40,964 ERROR main TestContextManager:258 - Caught exception while allowing...

Spring and JUnit annotated tests: creating fixtures in separate transactions

I am testing my Hibernate DAOs with Spring and JUnit. I would like each test method to start with a pre-populated DB, i.e. the Java objects have been saved in the DB, in a Hibernate transaction that has already been committed. How can I do this? With @After and @Before, methods execute in the same Hibernate transaction as the methods d...

Under what conditions should I test get() and set() methods?

I could not confirm whether to do these tests. It seems the set and get method is so simple,such as: setA(String A) { this.A = A; } getA(){ return A; } Any ideas would be appreciated! Thanks, Joseph ...

Junit with .Net Technologies

Is it possible for us to integrate the junit test cases for an application for which we are developing using the ASP.Net Platform? Since I am from Java j2ee Tech background, have a very less knowledge on .Net Technology ...

JUnit for Functions with Void Return Values

I've been working on a Java application where I have to use JUnit for testing. I am learning it as I go. So far I find it to be useful, especially when used in conjunction with the Eclipse JUnit plugin. After playing around a bit, I developed a consistent method for building my unit tests for functions with no return values. I wanted...

Best way to unit test Collection?

I'm just wondering how folks unit test and assert that the "expected" collection is the same/similar as the "actual" collection (order is not important). To perform this assertion, I wrote my simple assert API:- public void assertCollection(Collection<?> expectedCollection, Collection<?> actualCollection) { assertNotNull(expectedC...

Using Tyburn with Maven

Guys, I"m trying to use Tyburn to do some BDD with JBehave and I've got a question about what Tyburn can do. Can Tyburn simulate Menu selections? Like Ive I want to say something like @Then("when I select 'Start' from the Recording Menu) selectMenu(Recording) selectMenuItem(Start) Is there a way to make this happen? Thanks, Joe ...

Testing Hibernate DAO, without building the universe around it.

We have an application built using spring/Hibernate/MySQL, now we want to test the DAO layer, but here are a few shortcomings we face. Consider the use case of multiple objects connected to one another, eg: Book has Pages. The Page object cannot exist without the Book as book_id is mandatory FK in Page. For testing a Page I have to cr...

eclemma - how to ignore source

Hi, I'm using junit/eclemma; it works great, except I'd like to instruct eclemma to ignore certain methods or classes. For example, how would i instruct eclemma to ignore getters/setters. Thanks in advance! ...

JUnit Test method with randomized nature

Hey, I'm working on a small project for myself at the moment and I'm using it as an opportunity to get acquainted with unit testing and maintaining proper documentation. I have a Deck class with represents a deck of cards (it's very simple and, to be honest, I can be sure that it works without a unit test, but like I said I'm getting u...

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

I want to generate XML oupt result with Selenium R. How to do ?

Hi, I create a test suite with Selenium IDE. I use a ant task to execute it with htmlSuite but the result is created in HTML. How can I generate the result into JUnit XML output understandable by Bamboo ? Thanks a lot ...

Unit testing nested subflows (subflows of subflows)

I'm trying to write unit test for a flow, which has subflow, which, itself, has another subflow. I register first flow using FlowDefinitionResource getResource(FlowDefinitionResourceFactory resourceFactory). Then I register subflow definitions during test execution in FlowDefinitionRegistry before transitioning to them. Transitioning ...

How to deal with the test data in Junit?

In TDD(Test Driven Development) development process, how to deal with the test data? Assumption that a scenario, parse a log file to get the needed column. For a strong test, How do I prepare the test data? And is it properly for me locate such files to the test class files? ...

How to write something to surefire log with JUnit 4

Is it possible to write something from inside the test to surefire-reports/MyClass.txt ? Any kind of logger etc ? There is a Reporter in TestNG: Reporter.log("Something here"); and the message appears under test method in report. Is there something similiar in JUnit ...

Is there a way to distribute junit tests so they all get done faster?

Our JUnits take a total of 6 hours to run. Is there an easy way to run 1/n of them on n different machines? ...