use strict; use warnings; use Test::More tests => 1; use Test::Warn; # Your code which gives an expected warning sub foo { warn "Stripe Webhook Error: Invalid Stripe Signature\n"; } # Test your code warning_is { foo (); } "Stripe Webhook Error: Invalid Stripe Signature\n", 'Invalid sig warning issued';