I have a question about testing how can i test WebService class in the Test class ?
Hi! You do want to test the WebService class itself, i.e. testing the main method?
Yes, i want to launch the app like in production
1st and foremost, that part of using quantummaid has no tutorial yet, but there is one scheduled for June (this year :D)
If you are going to invest some creativity, the idea is to start your production endpoint and run your tests against it. Since httpmaid is kinda endpoint agnostic, it all depends on your preferred production endpoint. If it's jetty (or you want to run in docker, which will be a jetty endpoint packaged into a docker container) you start the jetty endpoint on a port of your choice from a JUnit test listener thingy and make that port available to your test cases.
The full plan is a bit more elaborate than that though, so please let me explain the roadmap. Testing is a delicate topic with people arguing that TDD with fine-grained unit tests will automatically lead to good architecture. We followed that approach for several years and experienced that these tests aren't of much help if you do refactorings that go beyond the internals of a single class. After a refactoring only integrated e2e tests can tell you if the whole system behaves the same way as it did before. The problem with fully integrated tests is that they tend to be slow and lead to long developer feedback cycles. The common advice in this situation is to have both unit tests and integration tests (https://martinfowler.com/articles/microservice-testing/). As this leads to a lot of duplication, we decided to only write integration tests. To counter the long feedback cycles, we introduced the concept of test modes. Each test case can run in different test modes. A test mode could be InMemory, RealHttpWithInMemoryDB, Integration (full integration mode, no in-memory stubs), etc. Then you can run the test suite in one of the modes by setting a cfg value, eg. an environment variable. While you are developing, you would run the tests in an ultra-fast in-memory configuration. The CI/CD server on the other hand would run the same tests in full-blown integration mode with a real database, real infrastructure, etc. The point is that you write the test cases only once. This is our approach to avoid (partial-)test case duplication between the integration test suite and the unit test suite. For us, that’s solving the main issue of integration testing. We still write unit tests to explore new things, but we have an internal policy that unit tests may only be written if they could be deleted without losing any confidence in the correctness of the overall system. It's not possible to make an educated estimation when all of this will be supported, but my gut feeling is that we will release some parts of it by October this year. You can already create different test configurations by replacing the endpoint in HttpMaid, but this is still work in progress and not documented. Nonetheless, you could have a look at the code. Any kind of feedback it greatly appreciated, and we can help you with any questions you have either here, in our Slack channel or in a pair programming session over skype/hangouts/... - at the moment there are not that many users, so we can afford that.
Thanks for the explanation, i understand the approach, i will continue to play with, actually i'm playing with injectmaid and httpmaid, i noticed other related modules like eventmaid, mapmaid and documaid. What's good is that the code is clear enough, i can understand easily the logic without documentation.
No problem! It's nice to hear that the code is clear and readable
Hristo I Stoyanov
I assume injectmaid works well with Java modules?
We didn't test it yet with modules, so we can't say anything in this regard with confidence (it is tested in a vanilla Java 11 environment) . However, InjectMaid isn't doing anything that appears to be inherently problematic with Java modules. You could give if it a try and see if it works in your setup. We would be happy to hear about any problems that arise and will try our best to fix them. Please keep in mind though that it's been less than a week that the project has been released and it is still in alpha.