O'Reilly logo

Development with the Force.com Platform: Building Business Applications in the Cloud, Third Edition by Jason Ouellette

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

Testing the Missing Timecard Feature

To achieve adequate test coverage, add unit tests to the Batch Apex class that create assignments and timecards in various combinations, kick off the batch, and then query the Missing Timecard object and verify the presence of the correct data.

You can also test informally from the user interface and the Execute Anonymous view in the Force.com IDE. For example, create an Assignment record for the GenePoint project, starting 4/1/2015 and ending 4/30/2015 for Rose Gonzalez, and set its status to Scheduled. Enter a timecard for her for week ending 4/11/2015 on the GenePoint project, and set its status to Approved. Now run the MissingTimecardBatch from Force.com using the code in Listing 9.11.

Listing 9.11 Running ...

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