0

In simple words: How to runs in eclipse tests with building process (as simple as possible)?

I want to execute test defined in pom with every maven build. Currently all is build, but none test is run. When I execute maven test it runs test, but during build it only builds. How can I add this phase to eclipse build process?

I already read Eclipse Maven Build and Test with One Button, and it is close to optimal, still I would like to run tests with build to be more TDD.

Community
  • 1
  • 1
SkorpEN
  • 2,491
  • 1
  • 22
  • 28
  • I think TDD can happen without you needing to test with every Eclipse build. Do you have auto-building enabled for your project? – Duncan Jones Dec 15 '14 at 09:53
  • Yes I got. I could enter running program with command line, still it is not very convinient. – SkorpEN Dec 15 '14 at 10:01
  • To be very clear on your requirements - you want the Maven test goal to be executed whenever Eclipse does an incremental build? – Duncan Jones Dec 15 '14 at 10:22
  • Not necceserly. Anything that will run my tests after build will be just fine. Maybe I could run maven from command line to execute just tests. I see ant file, it should work, still I would like simpler solution. – SkorpEN Dec 15 '14 at 10:28
  • I'm a little confused now. How exactly are you building? After what exact action do you want the tests to be executed? – Duncan Jones Dec 15 '14 at 10:31
  • I got maven builder, still I can add to project builders anything. I can choose order of actions there. I need run tests after compilation phase. – SkorpEN Dec 15 '14 at 10:33
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/66908/discussion-between-duncan-and-skorpen). – Duncan Jones Dec 15 '14 at 11:01

1 Answers1

0

My solution(might not be optimal):

  1. require maven runpath
  2. Go to Project -> Builders
  3. Add new Program
  4. In Edit configuration enter (as on picture):

    Location: your/maven/path

    arguments: test -f /yourProjectPomPath/pom.xml

Running AutoBuild Option

As on picture tab Build Options -> Check(click) During auto builds option select

  1. Save changes and check if all works
SkorpEN
  • 2,491
  • 1
  • 22
  • 28