I'm currently working on a java project using maven. We use the maven surefire plugin to run our junit suite as part of the build process.
Our test suite is rapidly growing, in both coverage and execution time. The execution time is very frustrating and time consuming when you end up waiting ten minutes to find out that a test failed...
I want to run my all test cases which is written in both junit versions(3.x & 4.x) in JSP. if i called that jsp it should run all test cases. pls guide me.
thanks for advance.
...
If I have a basic accessor method that returns an ArrayList
What exactly would i test for it?
I am very inexperienced when it comes to testing.
...
My Junit test should check that the number being returned is the same as the list size
if my test was as follows would this be coded properly, i feel it isnt because i the last 2 lines are always going to be true?
public void testGetTotalPilots() {
ArrayList<Pilot> list = new ArrayList<Pilot>();
int size = list.size();
as...
Hello,
I would like to compile JUnit from windows command line.
I have a project that contains many different packages. I can compile and run this project from the command line. However, I have difficulties to compile JUnit class that I have created.
My JUnit class imports only my model and uses the methods to ensure that my model is c...
I want to ask for your prefered way to test JEE code?
I found only three project, that are trying to help to code unit tests in JEE environment:
http://jakarta.apache.org/cactus/ : Last Published: 2009-01-18
http://www.junitee.org/ : Last Release: 2004-12-11
http://ejb3unit.sourceforge.net/ : Last Release: 2008-05-17
So I wonder,
...
I'm running some JUnit 4 tests in eclipse for my Java project which I know have functioned two days ago without problems.
Today, though, I get errors:
Could not connect to: : 40212
java.net.SocketException: Network is unreachable
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect...
Hello!
Is there a matcher in Hamcrest to compare collections for equality?
There is contains and containsInAnyOrder but I need equals not bound to concrete collection type.
E.g. I cannot compare Arrays.asList and Map.values with Hamcrest equals.
Thanks in advance!
...
I feel stupid for not being able to find this, but where is the JUnit plugin for Eclipse? I've included the latest .jar in my buildpath, but I still don't have the option to create a new test case, run test cases with the green/red bar, etc. I need the plugin for this, right?
EDIT: I'm using "Eclipse for PHP Developers". So perhaps that...
I have a test suite class:
@RunWith(Suite.class)
@Suite.SuiteClasses({
GameMasterTest.class,
PlayerTest.class,
})
public class BananaTestSuite {
What annotation do I need to use to make a function in this class run before any of the classes containing actual tests? Right now, I'm doing this, and it works, but it's not as read...
I think I'm not using verify correctly. Here is the test:
@Mock GameMaster mockGM;
Player pWithMock;
@Before
public void setUpPlayer() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
pWithMock = new Player(mockGM);
}
@Test
public void mockDump() {
pWithMock.testDump();
...
I wanted to start a discussion about the details that you cover in your unit tests.
Do you test major functionalities, that consist of several methods doing one task at once with one test?
or maybe you even test automatic properties?
Because, for example, I see little value in writing a test that would test only this:
public Email
...
We are writing JUnit tests for a class that uses Spring autowiring to inject a dependency which is some instance of an interface. Since the class under test never explicitly instantiates the dependency or has it passed in a constructor, it appears that JMockit doesn't feel obligated to instantiate it either.
Up until now we have been us...
I'm trying to run some JUnit test units in eclipse 3.5, but with no luck at all.
JUnit3 works fine.
When I create the JUnit4 Test unit, eclipse offers to add the JUnit library to the class-path. I accept, but when i check to see if it was added in the project's properties panel, I can see JUnit4 was added, but no JARS where included.
I...
I'm using EasyMock to create mock objects for JUnit testing in Java. I create a mock object and pass it to another thread where it expects methods to be called. In the other thread, the calls are enclosed in a try/catch(Throwable) block, so when an unexpected call occurs on the mock and it thus throws AssertionError, that error is caught...
Is there any way of replacing the logic within a private method when running a JUnit test?
A bit of background: we have some private methods which interact with bundles within an OSGi container. This is not available in the unit test therefore the methods will fail.
We have looked at JMockIt but the method replace functionality seems t...
What is the best way run a lot of integration tests using JUnit?
I crudely discovered that the code below can run all the tests... but it has a massive flaw. The tearDown() method in each of those classes is not called until they have all been run.
public class RunIntegrationTests extends TestSuite {
public RunIntegrationTests(){
...
Hi
I'm using Galileo Eclipse on Ubuntu running inside a VirtualBox VM hosted on Windows XP.
Eclipse is running under JDK 1.5 ( via the -vm command line switch )
The project that I am working with runs under JDK 1.3 ( set via the Build Path )
When I run a unit test from within eclipse ( by right clicking the source file and doing "Run...
It's a Java (using JUnit) enterprise Web application with no mock objects pre-built, and it would require a vast amount of time not estimated to create them. Is there a testing paradigm that would give me "some" test coverage, but not total coverage?
...
Hi everybody!
I am using Maven for my project and have following qustion:
I want to see the logging output of my JUnit tests (log4j, System.out, whatever) in tests reports. Do you have any idea how to achieve this?
Thanks ;-)
...