junit « junit « Maven/Ant Q&A

Home
Maven/Ant Q&A
1.Ant
2.artifact
3.dependency
4.deploy
5.Development
6.eclipse
7.glassfish
8.hudson
9.integration
10.jetty
11.junit
12.m2eclipse
13.module
14.netbeans
15.package
16.plugin
17.POM
18.repository
19.svn
Maven/Ant Q&A » junit » junit 

1. How to retrieve maven properties inside a JUnit test?    stackoverflow.com

I'm writing a test for a file parser class. The parse method receives a file name as parameter, and must open it in order to parse it ( duh ). I've writen ...

2. Is there a way to separate long running (e.g. stress tests) out so they're not run by default in Maven 2?    stackoverflow.com

We've had an ongoing need here that I can't figure out how to address using the stock Maven 2 tools and documentation. Some of our developers have some very long running JUnit ...

3. Classloading issues in maven2 with JUnit    stackoverflow.com

I have a project that builds with maven2 and runs a series of JUnit test cases against the code. This has worked fine up until this point, where I now ...

4. Maven:Using JUnit test-help required    stackoverflow.com

Hi In my project, I have lot of test cases. What command can be used to selectively run one Test suite/test case? Please help

5. Maven 2 Not Running Junit 4 Tests    stackoverflow.com

I'm having an issue getting surefire to run Junit4 tests. This same issue was reported in http://stackoverflow.com/questions/2021771?sort=newest#sort-top but the solution there was to removed the offending dependency whose transitive dependency ...

6. Run tests from inner classes via Maven    stackoverflow.com

I have following tests structure:

public class WorkerServiceTest {

    public class RaiseErrorTest extends AbstractDbUnitTest{
        @Test
        ...

7. How do I halt Maven when JUnit Fails?    stackoverflow.com

I am running Junit tests from Maven. The ant script has

<junit failureproperty="failproperty" errorproperty="errorproperty">        
           ...

8. Cleanest way to get a File in a JUnit test case from Maven    stackoverflow.com

My test code in Maven project B (which is a child of project A) has something like

String filePath = "src/main/webapp";
//do something with the filePath
The above test case runs fine when I ...

9. Is there a way to prevent Maven Test from rebuilding the database?    stackoverflow.com

I've recently been asked to, effectively, sell my department on unit testing. I can't tell you how excited this makes me, but I do have one concern. We're ...

10. Using Tyburn with Maven    stackoverflow.com

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

11. How to run junit tests by category in maven    stackoverflow.com

Using junit 4.8 and the new @Category annotations, is there a way to choose a subset of categories to run with maven's surefire plugin? For example I have:

@Test
public void a() {
}

@Category(SlowTests.class)
@Test
public void ...

12. JUnit 4.8.1 / Maven trivial test not working    stackoverflow.com

Although I tried out all suggestions I found, I still can't get the most trivial JUnit test running. The error message basically repeats saying "junit.framework.AssertionFailedError: No tests found in project002.trivial.TestClassTest". You may ...

13. How to let maven run a single test class with non-default profile activated?    stackoverflow.com

I'm trying to let maven run a single test class but I need to use an additional profile (which in fact is already created). Normally when I run: mvn clean install -PmyProfile "myProfile" ...

14. How to change JUnit transformation in Maven2    stackoverflow.com

I have Java project built with Maven2. There is used JUnit framework for testing ( and Selenium but it is irrelevant ). I would like to add screenshot ( I have ...

15. Including jMock 2.6.0 in Maven    stackoverflow.com

I am unable to include the new jMock release as Maven dependency. Here is what I tried including:

<dependency>
    <groupId>org.jmock</groupId>
    <artifactId>jmock</artifactId>
    <version>2.6.0</version>
</dependency>
I have ...

16. Why is a junit test that is skipped because of an assumption failure is not reported as skipped?    stackoverflow.com

I use junit assumptions to decide whether to run a test or not.
Tests where the assumption fails are ignored/skipped by the junit framework. I wonder why skipped tests are not ...

17. Maven - synch "main" folder with "tests" folder    stackoverflow.com

I'm just starting to use Maven with my project. All of my production code is of course inside the main directory. As I add unit tests to my tests directory, is ...

18. where to put maven parametrized junit input xml files    stackoverflow.com

I have parametrized junit test that reads from several XML input files. In the code, I have it like this:

@Parameters
public static Collection<Object[]> getFiles() {
  Collection<Object[]> params = new ArrayList<Object[]>();
 ...

19. Different flavors of JUnit?    stackoverflow.com

I'm trying to fresh up my Java and also to learn how to use Maven and JUnit. Following the Maven quick start I ran the following in the console:

mvn ...

20. InitilizationError when JunitTest with Maven    stackoverflow.com

I'm trying to do some Junit-Test's with Maven3 but always get some initilizationError(some testclass here) when executing test which have JUnit-Annotations (all other tests run fine). When I run the tests ...

21. maven test behind proxy (squid)    stackoverflow.com

I'm having a problem with maven behind a squid proxy server. I have a module of my system that depends external communication with a remote webservice. I have my maven proxy configurations under ...

22. JUNIT custom runner does not recognized from Maven test goal    stackoverflow.com

I have custom runner of JUNIT, run with annotation: @RunWith(SomeClass.class) When running maven goal test it does not run it. What should be done? is it configurable?

23. Where do I put properties files for running JUnit tests on Maven?    stackoverflow.com

I'm using Maven 3.0.3. I'm running the "mvn test" command, in which my test files are in the standard place (src/test/java). Where do I put properties files so that ...

24. Maven does not find JUnit tests to run    stackoverflow.com

I have a simple program for which maven compiles it and its tests fine, but when I run mvn test it does not run any tests (under TETSTs header says There ...

25. maven-failsafe-plugin: how to pass option to JUnit?    stackoverflow.com

I use maven-failsafe-plugin to run my integration tests. When it fails, I see full stack trace. For each failed test case it may has about ~50 lines, most of ...

26. Issue with Maven not running my Junit tests properly    stackoverflow.com

I am trying to test a java app from Maven using JUnit. I have the following POM (relevant section only).

<plugin>
            ...

27. How do I configure maven to print JUnit assertion failure message to console    stackoverflow.com

I'm using the surefire maven plugin to run unit tests. My test class looks like this:

public class Test1 {
  @org.junit.Test
  public void testThatFails(){
    Assert.assertTrue("false is never ...

28. Testing Clojure and Java simultaneously    stackoverflow.com

I'm developing a library that contains both Clojure and Java code, using Eclipse + Maven to manage the project. I have a good set of JUnit tests that cover the Java portion ...

29. Avoid Maven complaints about mock objects without any @Test    stackoverflow.com

Maven 3.x.x complains about my mock "TestPacket" class that I use for another real test:

java.lang.Exception: No runnable methods
How can I avoid Maven complaining about this? I did this for now (in TestPacket):
@Test
public ...

30. Junit tests failing when triggering Maven build using JDK 1.6    stackoverflow.com

My project build succeeds when I use Java 1.5. But fail on 1.6 for some unusual reasons. I see that only my JUnit tests fail. Some genuine assertions which used to ...

31. How to integrate my test library with JUnit and Maven?    stackoverflow.com

I have a test library, which reads test definitions from text files and runs tests using these definitions. Now I would like to run it with junit using maven. So, I ...

32. How to launch maven filtering from jUnit test?    stackoverflow.com

Situation: I have a class MyController that works with some external WebServices.

public class MyController {
    private String integrationWebServiceURL;
}
This class web services URL is passed during configuration controller bean ...

33. How to read Maven properties from JUnit test?    stackoverflow.com

I'm using Maven 3.0.3 with JUnit 4.8.1. In my JUnit test, how do I read the project.artifactId defined in my Maven pom.xml file? In my pom, I have

<project xmlns="http://maven.apache.org/POM/4.0.0" ...

34. Can't run single test method with maven    stackoverflow.com

i know how to run Junit test class:

mvn test -Dtest=classname
but when i tried to run a single unit test method as follows:
mvn test -Dtest=classname#methodname
i always get the error: that no test ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.