2

I want to do unit test on Spring Web Application using Spring Test. When I tried to learn in web got all the tutorials with maven. We are not using maven in our project. Is there any way to do this test without maven.

programmermurali
  • 159
  • 1
  • 3
  • 10
  • I think one way would be to use one of the maven examples. Then execute "mvn dependency:copy-dependencies". This will copy all required jar files in the target folder. These jars will be (well most of them) required in the classpath to run a test without maven. From both the JUnit and Spring view no maven is needed to run tests. – wemu Oct 16 '13 at 07:46

1 Answers1

2

maven is a tool for build processes. You really don't have to use it.

  1. What you need is to write tests with a testing framework, for exapmle junit
  2. The dependencies you need (spring, junit) must be in your classpath. If you're not using maven then any other way you prefer.
  3. You can use this question to run tests from command line if that's what you need.

To make it clear in other words - maven provides you with a build cycle that downloads your dependencies and put them in your classpath. This is something that you can do manually (configure your classpath and put needed jars in the classpath). The second thing maven gives you is the test life-cycle. But you don't have to use it and you can run unit-tests from command line according to the link I put in bullet 3 or running through the IDE. Most of eclipse and Intellij versions come with built-in support for running tests.

Community
  • 1
  • 1
Avi
  • 21,182
  • 26
  • 82
  • 121