Integration Testing Best Practices

Grunt Test Commands Read about the Grunt commands used to run tests in our Integration Testing Overview.

Best Practice: Test as you Develop Write tests as views are developed. Write tests once your context properties are defined to ensure that the desktop page is transformed correctly to the mobile version.

Best Practice: Run Tests Often Integration tests are designed to run quickly which encourages you to run them often. At minimum, run tests before you build a bundle.

Best Practice: One Assertion Per Test Limit the number of assertions to 1 per test, or to 1 property per test.

Best Practice: Write Tests that are Sufficient Use your own discretion. Test for expected types, values, and lengths of your context properties.

Examples of expected types: Object, String, Array, etc. Test for equality to expected value. With the expected value, test for equality, greater or less than.

Best Practice: Test with Multiple Fixtures Test multiple page conditions with multiple fixtures in one test script.

Best Practice: Test Global Site Features in a Separate Test Files Global includes, such as a header and a footer, have their own test files.

If states change on different templates (like a different header for the checkout page), create a new block of tests for that file. Use fixtures that represent different states.

Edit in GitHub