-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Mastering Application Development with Force.com
By :
After creating test data and calling test.startTest(), we are now left with executing our code. This is where our general testing pattern branches into three subpatterns. Each of these subpatterns does execute the code, but each in their own unique and important way. Of the three, the first subpattern is the easiest to understand and what you're most likely to have run across. I call this types of tests Positive tests because they're based in the positive assumption that your code is working as intended with valid data. The second subpattern is less intuitive, but far more powerful. I call these Negative tests because they test what happens when exceptions occur. Lastly, there are Permissions tests that test how your code functions with different users, roles, and permission sets. Let's take a more detailed look at all three.
Positive tests prove expected behavior. That is, they prove that the code functions as it is intended to when given valid input. Succinctly...
Change the font size
Change margin width
Change background colour