4 ms·
Testing and certainly TDD usually fall by the wayside because it takes too long. At least that is the perception. I see two keys to keep tests lightweight, fa
by jordanpg 12y ago
Testing and certainly TDD usually fall by the wayside because it takes too long. At least that is the perception. I see two keys to keep tests lightweight, fast, and desirable.
First, you should choose testing and mocking libraries and learn them completely and totally. They are usually not that complicated. Read all the docs and memorize all the neat things they can do. Most libraries have a best practices guide. Read it and follow it. The point of this is to make sure that you can write tests as quickly as you can write trivial if/then statements.
Second, keep your tests as simple as possible while still testing behavior. Do not verify that every variable is set or if every method is called, or the right thing is passed everywhere. The tests should read like documentation: it should do x, it should do y. If you find the process of writing tests arduous or difficult to maintain, you're overcomplicating your tests (and probably your code, too).
In a word: lightweight.