Unit Tests in Module Dev

I’m currently working on a largeish module, and we’ve got Junit working with maven for our unit tests. I’m struggling to get test coverage over a few classes in our module because we’d need some sort of proxy to mimic Ignition gateway services. I’m just curious, what do IA do for unit/integration tests? Do you guys have a framework to spin up a docker image and test against that or?

We don’t use containers in any unit testing scenarios, though they do come in very handy for integration tests; for instance, each PR we open against the Ignition codebase is automatically deployed as a container for QA to test against.
For most complex unit tests, we (unfortunately) rely on mocking/stubbing base classes via Mockito. In a perfect world, as many classes as possible would be structured so that such a thing isn’t necessary, but it’s often impractical, especially with legacy code, to try to restructure things to be more ‘pure’ (in the functional sense).

3 Likes