Ember Testing in 2019

Gaurav Munjal
2 min readJun 11, 2019

--

Testing has always been a strength of Ember. With awesome addons like ember-test-selectors and ember-cli-page-object, writing tests for a standard Ember application is easy. Generators automatically create test files, and great test helpers have been provided. The recent RFC 232 overhaul has made testing even easier with async / await.

Yet, it is still too hard for some organizations to start testing. Given an existing codebase with little testing coverage, writing tests is daunting. Tutorials on writing tests with Ember are too narrowly focused. There is little guidance on how to develop those first fixtures and mocks, and on patterns like page objects.

People writing ember tests still have to know about internal Ember details like the Ember run loop. Writing a test where you expect an error to be thrown is a nightmare thanks to the testing harness catching them.

Many addons for Ember, including those with the top 100 downloads, have few or no tests. Worse, they don’t provide test helpers or any other help for the users of those addons to write tests.

Testing is particularly hard for users of FastBoot and Engines. FastBoot currently does not make it easy to run your existing test suite in FastBoot mode. ember-cli-mirage is completely incompatible with FastBoot. Engines has, after several years, still not documented a testing story. Users of lazy loaded engines can have no confidence that tests pass means their app works because all engines are preloaded during testing.

It is important, that as we go forward as a community, we don’t give up our lead in this area and address these pain points that continue to make testing difficult.

--

--