sandeepkunkunuru
sandeepkunkunuru

Reputation: 6430

Automated unit testing for java as soon as code changes

Are there any tools/libraries like Guard (for Ruby on Rails) for Java which listen to file system changes i.e. changes to the code files in the project and automatically run unit tests associated with that class or the entire project.

Upvotes: 3

Views: 354

Answers (3)

Dwight Spencer
Dwight Spencer

Reputation: 1596

The interesting thing is that yes, Guard.rb does support java thanks to the guard-java gem. Best thing of all is that this does support maven, ant, or what ever your build system is. This allows for setting up jenkins and cucumber then having guard run your tests as you edit the features/source code.

Add the following to your project's Gemfile:

gem 'guard-java'

Then issue bundler install && guard init java

The rest can be read at https://github.com/infospace/guard-java

Upvotes: 1

Aurélien Thieriot
Aurélien Thieriot

Reputation: 5923

I don't know if you are still up for an answer but I wrote a small tool, inspired from Guard, that could do what you want:

https://github.com/athieriot/JTaches

It uses the Watcher API available in Java7

Hope it helps

Upvotes: 0

cleg
cleg

Reputation: 5022

Looks like you need something like Jenkins, running locally + FSTrigger plugin.

But if you need to monitor file system changes from your app (Guard is general-purpose tool), there is discussions on Stackoverflow about it:

Is there a sophisticated file system monitor for Java which is freeware or open source?

File changed listener in Java

How to detect filesystem has changed in java

Upvotes: 2

Related Questions