I've built a console line application for importing CSV data, validating against a set of constraints and then adding it into a database if it passes all validation. As such, I've developed a few classes for common classes such as:-
- Test data is not too long
- Test data matches RegEx
- Test data exists
These all have their own try-catch blocks, and in the try-catch block, I've set it to send an email to a generic inbox with the Exception. This is a requirement for when it goes live, so we are aware if something does fail.
I've written unit tests to call those functions and have deliberately called these functions with a view to break them to see how the application performs and the results of these tests. But of course, when it breaks it hits the Exception and then sends me this email. This is killing my tests, each test has gone from <1ms to 10-15secs and we're getting this spam everytime we test. Yet we need to keep these tests for when the project is live.
Is there some way to specify that tests wont send emails or will the #debug command work here?
Thanks, Mike.