Coding the Simplest Testing Framework (Java)
There are loads of testing frameworks out there. Some very complex, powerful and excellent. I wouldn't be without them, but they're potentially quite difficult for those unused to the concept. While working on an embedded project, with very few tools at my disposal, I quickly whacked together this simple testing framework and decided to blog it. Essentially you would put this import at the top of your code: import static net . intrepidis . library . SimplestTest . test ; Then you can use it like this: test ( 7 + 8 ) . is ( 15 ) ; What will happen is that if the test fails then an exception is thrown. Essentially that is all there is to it. Proper testing frameworks catch this and display very helpful messages at the end of all the tests. Please visit this other blog for some real-world examples: Using TotallyLazy the functional library for Java For a "proper" testing framework I recommend Hamcrest . Meanwhile, below is the actual Simple...