That sounds like trace based testing - Testing System/Unit Behaviour Using Traces/Logs/Signals
The example might be easier to test if its decoupled and the create_article just publishes an event {:article_created, article} that your analytics stuff (or your tests) can subscribe to.