lordofthejars / nosql-unit

NoSQL Unit is a JUnit extension that helps you write NoSQL unit tests.
Other
383 stars 123 forks source link

Fix tests and Setup a CI system #193

Open tinesoft opened 5 years ago

tinesoft commented 5 years ago

Hi @lordofthejars

I'm almost done implementing #191 , but i'm facing a major issue that prevents me from submitting any PR just yet: TESTS !

I'm glad to see the effort you put in writing so many of them 👍 💪 , but currently, almost none are working, even worst, some do not even compile.

I can understand how challenging it is to set-up and maintain a proper testing environment, due to the variety of dependencies each sub-module has. But i believe this burden can be greatly alleviated with use of Docker and a CI environnent like Travis (free for opensource projects).

tinesoft commented 5 years ago

My idea is to use Docker (via docker-compose) to setup all dependent services of each sub-module (a elasticsearch, a mongo db, a cassandra,... ), then run the tests from the resulting docker image that will contain all those services up and running. That way we can have a repoductible testing envionnment, and then automate testing via Travis (which supports Docker)

A POC of that concept can be seen on my current branch https://github.com/tinesoft/nosql-unit/tree/feat-elasticsearch6.

The important files are:

I have also made a few alteration to the main pom.xml by moving away the maven-gpg-plugin, maven-javadoc-plugin, and maven-source-plugin to a release profile ( only needed when releasing artifacts, there is no need to run them when running tests)

Here are the results of the build on Travis: https://travis-ci.org/tinesoft/nosql-unit/builds/520609046#L931 - As you can see basic tests on the nosqlunit-core are failing, i don't see how to solve them...

If you agree with this POC, i can provide my help in setting all this. But i will need yours to fix the tests.

This could defintively improve code quality of this great project and ensure easy integration of future PRs.

What do you think?

Tine

lordofthejars commented 5 years ago

I completely agree with you regarding this and thank you very much for the effort. So let's do one thing when you finish everything let's merge the change (of course the build will fail because of these tests but then I'll send a PR fixing all of them.

tinesoft commented 5 years ago

Neat-o!

Ok, I will submitting a separate PR tonight, to setup the testing environment (modified pom.xml, docker-compose.yml and .travis.yml) so that we don't mix with my current work #191.

Once you merge that new PR, and fix tests, i will then rebase my #191 on the fixed code and submit the PR.

Have a nice day!

ychaikin commented 5 years ago

@lordofthejars Kudos for creating this project! I really like the ideas implemented here.

I've been looking for a Mongo-based DBUnit type of framework and found this. Kind of got excited until I saw that JUnit 5 isn't supported yet, which is something I need on the project I am on right now. It's also missing another feature I'd need, but whatever.

So, I thought, fine, maybe I'll just contribute and add that support, at least for Mongo portion of it.

Then, I hit this issue. :-)

Do you guys have an immediate plans to fix this (by immediate, I mean like in a day or two)?

Unfortunately, I don't have the time to help you fix it and since the compile time error is in the core package, I can't simply ignore it and have enough comfort to proceed.

Therefore, for me, the "barrier to entry" to use this framework becomes too high, i.e., higher than writing my own with just the features I need.

lordofthejars commented 5 years ago

Well it is not easy at all, but notice that JUnit5 support is not something that you add for Mongo. It is something that probably could be almost everything in the core module.

ychaikin commented 5 years ago

I understand. Thanks for the quick and honest answer. I'll have to figure out what I do next.

All the success to you with this project though! Certainly looks very useful.

tinesoft commented 5 years ago

Hi @lordofthejars

Any updates on the fixing of the tests?

I may have an even better alternative to setup tests requirements. It involves using org.testcontainers library to spin up required dependencies through Docker and JUnit Rules/Extensions. The integration is really easy and avoid a lot of boilerplate code...

tinesoft commented 5 years ago

Hi Alex,

Still no updates on this?

I'd really like to contribute more on the project (support for Junit 5 for e.g) but until this major issue is addressed, it is a hard to go further.... As a OSS maintainer myself, I know how time consuming it may gets sometimes. Maybe consider adding new maintainers (yours truly 👼) to the project?

ychaikin commented 5 years ago

@tinesoft Not sure if you are testing with MongoDB for your backend, but... I haven't officially announced it, except to my team (who is starting to use it already), but I've just released mongoUnit.

It's for JUnit 5 and targets Spring Boot applications at the moment, but depending on interest (and potential help from others), we might move it towards being independent (but still supporting) Spring Boot.

Check out the site (along with repo) and the features: Testing MongoDB Spring Boot based applications: mongoUnit.org

I was going for "It must be super easy to use" and so far it seems I've hit that. Plus, based on feedback so far, there are other ideas on how to lower developer effort even more.

tinesoft commented 5 years ago

Hi @ychaikin

That sounds interesting, I sure, will check it out for future projects involving both spring boot and Junit 5. Unfortunately, for my current project , i'm still stuck with regular Spring and Junit 4...