140 likes | 256 Vues
Learn advanced testing techniques on Force.com from Paul Battisson to enhance testability, flexibility, and speed in your development process. Discover the benefits of mocking, stubbing, and patterns to optimize your testing procedures for unit, integration, and acceptance tests.
E N D
Advanced Testing Techniques on Force.com Paul Battisson
Introduction • Paul Battisson (@pbattisson) • Xactium • What? • Mocking • Stubbing • Patterns • Next steps • Why? • Improve testability • Improve flexibility • Work faster
3 Types of Test acceptance integration unit
What's Wrong With Force.com Testing? • "Slow" to write • "Slow" to run • Brittle • High data dependence • Written badly • Coded badly - highly coupled • Lots of testing of DML
More Interfaces • Code against interfaces • Plug sockets (@simongoodyear) • Immediate improvement in flexibility and testability
Mock Objects • Implement the same interface • Used in place for a test • Assertions on how we expect the object to be called • Can contain stubs for flow • Allow us to test our object's interaction with its neighbours
Stubbing • Simulate real behaviour to get a test to pass • Implement in a mock object or using isRunningTest()*
Less Test Data Setup Insert a Record Required Fields? Instantiate a Mock Validation Rules? Before Trigger After Trigger
The Future Dependency Injection Metaprogramming Frameworks & Patterns
Thanks • Matthew Botos (@BotosCloud) • Simon Goodyear (@simongoodyear)
Thank you for • listening! • https://github.com/pbattisson/Advanced-Force.com-Testing Questions?