The best way to test a hexagonal architecture style application
… does not exist!
Whenever a sencence starts with “the best way”, it is probably wrong. Especially when it is not used within a very specific and narrow context. So if you read such a sentence, be carful. Recently there was a discussion on Twitter which I found interesting. It stated that parallelization is the anwer and another gentlemen retweeted with a comment that suggests „the best way“ is to find a way to test the same behavior with a faster test. Later he describes that the problem often are big end-to-end tests (integration test, acceptance tests, the terms are not standardized) which should be replaced with smaller (unit tests).
A bit longer ago I read a discussion about what a “unit” in unit tests is. Many years ago I found that there is no clear definition what “acceptance” tests or “integration” tests are. It is probably the same with “end-to-end” tests. Obviously some fuzzyness exists along those terms. Be aware of this in discussions and maybe find an ubiquitous naming within your team, division or company.
Some definitions for the scope of this article
When I write unit test they are organized in a way that one test file contains all test cases for one class (OOP) or one function (functional). More importantly, such tests would mock all their dependencies and be relatively small and execute fast.