I know a lot of you use Apple Mail.
Here is a script by @ShaneStanley that he says will work in macOS Sierra (and earlier I think):
###Debugging Apple Mail Rules in macOS Sierra
This debugging may require, or be enhanced by, Script Debugger 6.
SD6 is a great tool for all AppleScript debugging and development.