Learn how to write unit tests for Sugar 7 both back-end and front-end components. Get an overview of our test frameworks including practical examples.
Attendees of this session will come away with...
- An understanding of the unit test suites in Sugar 7.
- The ability to write and run unit tests for your own components.
1. Jasmine unit tests (FRONT-END)
- Tooling: Jasmine, Sinon.js, karma.js
- How to test a sugar component ? What to test? For what purpose?
- Writing a simple test. (practical examples)
- Spying/stubbing functions with sinon.js
- Example of more complex unit tests using stubs/spies and a fake server.
- Gulp tasks.
2. PhpUnit unit tests (BACK-END)
- Tooling: PHPUnit
- Writing a simple PHPUnit test for Sugar
- Mocking objects for testing
- Using data providers for testing multiple test cases with one harness
- Writing more complex PHPUnit tests
- Discuss setup(), tearDown(), setupBeforeClass() and tearDownAfterClass()
- Discuss test suites, the full suite, and isolated tests