devonfw / IDEasy

Tool to automate the setup and updates of a development environment for any project (Successor of devonfw-ide).
Apache License 2.0
8 stars 18 forks source link

Create integration tests #572

Open hohwille opened 2 weeks ago

hohwille commented 2 weeks ago

Bug #570 was a real blocker and an eye opener that we need integration tests. I wanted to wait till we have implemented more of the required core features before we work on integration test but now that I saw how easily we have green tests for a totally broken product, I think it is time to introduce integration tests.

IMHO with minimal invest, we can introduce very simple integration tests. Already by calling ide help or ideasy help we could have revealed this error before the merge.

Some guidance for writing integration tests with Java and Maven:

If somebody can create a PR for the minimal approach in a day or less, that would be a nice first step. Apart from that, I would expect that we create real integration tests (failsafe plugin) and create some boostrapping step before the tests are run or as setup method for each of these tests that "installs" our product somewhere in the target folder (${project.build.directory}) and can then run the test on top of this. JUnit is not really great for testing bash and CMD executions so we would need some test-infrastructure to invoke ide commands in a given shell of that pre-setup installation. Still we can discuss if we want to write integration tests in JUnit (or bash or whatever).

Please note that here we do not want to assert lists of files to be present like software/java/lib/security/blocked.certs. Instead a test could look like this:

hohwille commented 1 week ago

I created story #583 to get started with this epic.

hohwille commented 1 week ago

For the record: There is also https://testcontainers.com/ At least for linux there are free images of e.g. ubunut. We could run automated integration tests on linux that would work on any operating system with docker installed. Just an idea... Still not sure if we want to do this...