4

anybody knows whether unitils project is still alive. On there pages last version is 3.3 in maven repository it is 3.4.2.(Actually there is google cached version of their pages where the version is said to be 3.4.2)

Anyway is there any replacement for this project. I kind of lack the vivid community around and really don't want to be bound to dying project.

Zveratko
  • 2,663
  • 6
  • 35
  • 64

1 Answers1

6

Unitils seems to be almost abandoned nowadays. Project is available on the GitHub here and you can look at its history and activity.

Anyways my two cents...

Unitils has serious drawbacks:

  • Integrates many third-party libs (easymock, dbunit, spring, dbmaintainer, xmlunit, slf4j etc) and thus forces their versions - it is a really serious drawback
  • Due to being dependent on many 3rd party libraries, it is almost impossible to keep it up to date without any company behind.
  • Unitils 4.0 is developed since 06.2011 and was planned to release at 01.2012, but now (01.2016) after 4 years is still not released.

DbUnit

For database-driven apps it may seem that interesting way to go is a plain DbUnit + Spring-Test or alternatively some 3rd party tools:

  • excilys/spring-dbunit that comes with handy @DataSet annotation and is actively developed on the github, also is constantly updated to use the newest versions of DbUnit and Spring Framework.
  • springtestdbunit/spring-test-dbunit which is also hosted on the github (comes with a @DatabaseSetup annotation).

Both are very similar, but personally I find DbUnit confusing, quite cumbersome and time-consuming. Why? Try to maintain large amount of small xml files and you find out what I mean. Also combining multiple data sets is really hard.

DbSetup

DbSetup may seem like a tempting proposition, but I also do not recommend it at all due to many drawbacks, like no compile time type checking (Insert.values() accepts Object), it does not allow arbitrary SQL execution (only inserts and deletes are permitted), using this library leads to a not readable code.


UPDATE 2023: sorry, but TBH these days, when dealing with setting up a relational database I prefer to create test fixtures as close as possible to the test case + using the source code itself. Optionally with database foreign key constraints disabled (if it makes sense). Alternatively loading the tiniest possible DB dump from SQL file is also an option - but without any weird 3rd party tools like dbunit/dbsetup/whatsoever.

Hope it helps.

G. Demecki
  • 10,145
  • 3
  • 58
  • 58
  • The version madness is complete, not only inside libraries, but unitils itself. The usage of mockito vs. easymock is terrible. But so far I have been kind of happy, but now I have waken up to realize that I have slept to long. DBSetup looks good, but for bigger table the setup can clutter the code heavily. Although I really agree about maintaining multiple .xmls been big burden. – Zveratko Jan 08 '16 at 05:49
  • Another thing is that the projects you offered are Spring bounded. We are unfortunately not using Spring at all. – Zveratko Jan 08 '16 at 06:06
  • @Zveratko yes and no... `DbSetup` is not bounded to Spring at all - it just needs a `DataSource` to operate on. All other mentioned by me possibilities: **yes**, they need Spring - but surprisingly it's not a blocker too, because you can use `spring-test` module within unit tests, without using Spring at all in your normal classes. I went this way in one of my projects. – G. Demecki Jan 08 '16 at 08:11
  • 3
    Also, [AssertJ](http://joel-costigliola.github.io/assertj/) seems to provide a nice alternative to `assertReflectionEquals` with its [field-by-filed comparisons](http://joel-costigliola.github.io/assertj/assertj-core-features-highlight.html#field-by-field-comparison) – paulcm Nov 13 '16 at 12:28
  • @Zveratko according to https://www.versioneye.com/java/org.unitils:unitils/3.4.6 a release happened 3 months ago... – stantonk Apr 28 '17 at 23:14
  • @stantonk This was just a bugfix release. Project's homepage still seems to be dead, also it's [issue tracker](https://unitils.atlassian.net) shows no activity since June 2014 (but even that, it was just a tiny bugfix). There has been no serious activity for several years. – G. Demecki May 02 '17 at 05:08
  • @G.Demecki that's disappointing, it's a really nice abstraction over DbUnit, made it far easier to achieve multi-database, file-based configuration for testing, and easily override Transaction behavior to rollback after each test. Is there any alternatives (besides Spring)? – stantonk May 04 '17 at 03:46
  • @stantonk I don't know, because I've never used Unitils. But personally I cannot see any killer feature in Unitils which would be not available outside or would not be easy to implement. – G. Demecki May 05 '17 at 11:19
  • @G.Demecki easy is in the eye of the person's experience and available bandwidth :). i'm not aware of any where outside unitils that this functionality exists...do tell! – stantonk May 05 '17 at 14:59