Failing JUnit tests, not breaking my Ant script like I expect?
My continuous integration server runs an Ant script, which calls something like:
/tests/ant run-tests
My JUnit tests run, but with errors:
run-tests:
[echo] run-tests-helper.
[echo] Running tests ...
[exec]
[exec] com.zedray.stuff.FooBarTest:....
[e...
I am using JUnit 4 to test Dao Access with Spring (annotations) and JPA (hibernate). The datasource is configured through JNDI(Weblogic) with an ORacle(Backend). This persistence is configured with just the name and a RESOURCE_LOCAL transaction-type
The application context file contains notations for annotations, JPA config, transaction...
Today I saw a JUnit test case with a java assertion instead of the JUnit assertions - What are the best practices in this respect?
...
I've started using the new(ish) JUnit Theories feature for parameterizing tests. If your Theory is set up to take, for example, an Integer argument, the Theories test runner picks up any Integers marked with @DataPoint:
@DataPoint
public static Integer number = 0;
as well as any Integers in arrays:
@DataPoints
public static Integer[]...
Is it a best practice to put Javadoc comments in junit test classes and methods? Or is the idea that they should be so easy to read and simple that it is unnecessary to provide a narrative of the test intent?
...
Spreading test data across multiple small data sets seems to me to create a maintenance headache whenever the schema is tweaked. Anybody see a problem with create a single larger test data set? By "larger" I'm still only talk about a couple hundred records in total.
...
I've seen some people use the maven-sql-plugin to do this. But it seems like a task that is better suited for DBUnit....perhaps at the beginning of an entire test suite.
What's the best practice here?
...
When I try from within JUnit I enter:
public InvocationTargetException(Throwable target) {
super((Throwable)null); // Disallow initCause
this.target = target;
}
I know that I could put that code in an outer class and have servlet call it.
Can I not test a static method of a servlet in Java EE 5 container, from a JUnit test m...
I am learning Scala and would like to set up integrated unit testing in Eclipse.
As far as I can tell from googling, ScalaTest is the way to go, possibly in combination with JUnit.
What are your experiences with unit testing Scala in Eclipse? Should I use the JUnit runner or something else?
...
Hello,
i dunno if the question is already ask, but i couldn't find it... i'm searching a way to mock my view in order to test my presenter ? i try to use mockito for the view, and set it in the presenter, but in result in presenter, when i call presenter.getDisplay() (the getter for the view) all of my widget is null ? as i believe it's...
Dear All:
Sorry this is probably a very simple question.
I am using gradle http://www.gradle.org/ for my development environment. It works quite well!
I have written a simple unit test that uses HtmlUnit and my own package.
For my own package, I use java.util.Logger.
HtmlUnit seems to use commons logging:
http://htmlunit.sourceforge...
This is NOT a question about which is the best framework, etc.
I have never used a mocking framework and I'm a bit puzzled by the idea. How does it know how to create the mock object? Is it done in runtime or generates a file? How do you know its behavior? And most importantly - what is the work flow of using such a framework (what is t...
I have a strange issue with JUnit 4 tests in Eclipse 3.5 that I couldn't solve - any hints gratefully received!
Initially: I had a test suite working properly, with 100+ tests all configured with JUnit 4 annotations. I'd run these typically by right clicking on my source folder and selecting "Run as JUnit test". All worked perfectly.
N...
So I've started to layout unit tests for the following bit of code:
public interface MyInterface {
void MyInterfaceMethod1();
void MyInterfaceMethod2();
}
public class MyImplementation1 implements MyInterface {
void MyInterfaceMethod1() {
// do something
}
void MyInterfaceMethod2() {
// do something else
}
void ...
In the setup of my test cases, I have this code:
ApplicationContext context = new ClassPathXmlApplicationContext(
"spring/common.xml"
);
StaticListableBeanFactory testBeanFactory = new StaticListableBeanFactory();
How do I connect the two in such a way that tests can register beans in the testBeanFactory during...
I'm currently trying to write inside a log file the total number of failed tests from a JUnite Suite.
My testsuite is defined as follows:
@RunWith(Suite.class)
@SuiteClasses({Class1.class, Class2.class etc.})
public class SimpleTestSuite {}
I tried to define a rule which would increase the total number of errors when a test fails, bu...
Spring Test helpfully rolls back any changes made to the database within a test method. This means that it is not necessary to take the time to delete/reload the test data before each test method.
But if you use the @BeforeClass Junit annotation, then that forces the data loader to be static. A question that is explored here: http:...
Hi there,
Not sure if this is possible, but it'll save me a lot of time if it is. When I create a Junit4 test case in Eclise, I don't usually included all the methods that I'd like to test first, and later on, I'd like to add the untested methods or new methods to the test case. Currently, I'm doing this by typing new test methods in th...
Dear All:
Just wondering... I have some code (disabling certain logging output) that I'd like to be run before all tests...
I do not see any such examples for JUnit/Groovy testing in the samples directory... is there a good/correct place to put such code?
Thank you!
Misha
p.s. I am using the 0.9 preview 3 version.
...
I have Eclipse configured to use an external maven instance. Nonetheless I have an integration test that runs fine from the command line, but fails from within Eclipse. The error is a class Spring application context bean error:
Cannot convert value of type [java.lang.String] to required type
The culprit it a bean that sets property...