O'Reilly logo

Mastering Application Development with Force.com by Kevin J. Poorman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

When to write unit tests

Adherents of test-driven development argue for writing the tests first. Indeed, the idea behind test-driven development is that tests define acceptance of code. In general, the Test-driven development (TDD) approach is to write a test, see it fail, and then write just enough code to make the test pass. In practice, this is easier said than done. Others argue that you should write your code and then the tests because it's more efficient. I find the most successful developers almost always develop the code and the tests simultaneously, the code influencing the tests and the tests ensuring that the code is written in a maintainable, testable way. So long as the tests are written, and written well, I find it hard to argue ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required