Signup for the Ionic Newsletter to get the latest news and updates!

  • Stefan Huber

    Absolutely great that you start integrating unit testing into ionic! This is really important!

  • Marc Bruederlin

    This is awesome!

  • Mark Gibson

    I’m going a bit off topic, but was wondering what Ionic’s (and the team) view is on the Crosswalk Project shutting down? Do you guys foresee issues developing for Android due to fragmentation of the browsers?

    • yesimahuman

      Generally, no. Crosswalk is shutting down because it achieved its mission to help app developers with a consistent web environment for their apps. Android now ships evergreen, consistent Chrome, making that problem obsolete.

      If you’re targeting old versions of Android, you may want to see about using Crosswalk still (the project is still usable). However, we’re focused on modern Android (4.4 and above) as usage on older Android is declining rapidly.

  • Josh Morony

    Excellent, great work Rob and thanks to the Ionic team for getting this integrated. Can’t wait to see integration with the CLI (would be awesome to have unit tests as an option for each of the templates, e.g. ionic start MyApp blank –tests)

  • Allen Fernandes

    thank you for this, I was waiting for some official testing thing from the Ionic Team, till then @joshmorony:disqus and @lathonez articles really helped. 🙂

  • slainer68

    Great. Why do you not just write the tests in the Conference app instead of creating an app just to demonstrate unit testing?

  • MilanInLondon

    Very very very good news !

    Thank you.

  • Leif Wells


    There appear to be several minor problems with the code in this repository. Take a look at the Issues and Pull Requests.

    Other than PRs (which I have created), how do I get more involved with this effort?


  • DominikPinsel

    I just cloned the repository and tried to run the tests doing the described steps, but I just get exceptions.
    Does anybody else has this problem, too?

  • Rossana Bermudez

    Is it possible to test with coverage? If not, when is this going to be possible?

  • ilgiallomondadori

    Updating to Ionic 3 and using lazy loading, of course, breaks this testing setup completely. I am really not sure now how to set up my tests.

  • Imaginativeone

    Would someone point me in the right direction on the topic of unit-testing tabs?

  • Fco. Javier Lopez Garcia

    Do you have a complete example using Appium??

  • Fintan Kearney

    Unit testing is an afterthought in Ionic at the moment. This repo only shows us a very simple example and unit testing with full coverage is a lot of extra work. Simple enough to get an E2E suite set up however.

    Just some forewarning to other developers. If you’re looking for a full suite of unit tests with good coverage, you are going to run into a lot of impediments around Ionic and it’s lifecycle hooks.

    It can certainly be worked around but might not be worth the effort for your specific project.

    • Qasim Soomro

      Hope to see the nature of testing improved in Ionic moving forward!

  • melek Rebai

    How about integration tests ?

  • Allysa Macapia


  • Tom White

    Is there any update on this issue please? I’m sure I can speak for all experienced Angular users that we are desperate for this to be baked into the CLI.
    Interesting to note that the example you provide breaks from the Ionic folder structure (src/pages) and implements the Angular Style Guide folder structure (src/app/pages) , which unfortunately means that further Ionic Generate commands fail. Is there any chance you guys could make the CLI context intelligent like the Angular CLI? Or failing that have a custom configuration file?
    Keep up the great work guys. Your other features are so good that this omission sticks out like a sore thumb.
    Kind regards

  • Jeff Halhead

    I’m following this example and have found that the Ionic lifecycle events (eg. ionViewDidLoad) are not called. My page loads some data in ionViewDidLoad and renders it on the page. I want to write some unit tests for this but ionViewDidLoad never gets called so it doesn’t work. Has anyone else experienced this problem?

  • Qasim Soomro

    Thank you guys for this great article. Testing is the key to happiness and I’m glad to see this initiative towards TDD. Thanks again and hope to contribute.