I am reading about Alistair Cockburn’s Hexagonal Architecture with interest.
One claim he makes is:
Finally, the automated function regression tests detect any violation of the promise to keep business logic out of the presentation layer. The organization can detect, and then correct, the logic leak.
I do not understand this point. Is he saying that because the test is headless, then calls to a UI layer will throw exceptions? That doesn’t seem to be a very sound test!
His point is that having a suite of automated tests exercising all the business logic without a UI will make it clear if you have any business logic in the UI.
To make such a test suite, you essentially have to create a very thin testing-only “non-user” interface to supply data and check results. If any of your business logic is actually in the UI, you’ll find yourself replicating that logic in this testing interface, and realize your mistake.
4