# Testing - Example Issues?

**URL:** <https://discuss.emberjs.com/t/testing-example-issues/14607>\
**Category:** Testing\
**Created:** [April 22, 2018, 4:14pm UTC](https://discuss.emberjs.com/t/testing-example-issues/14607 "2018-04-22T16:14:32Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![rondale\_sc](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/rondale_sc/32/13883_2.png) [@rondale\_sc](https://discuss.emberjs.com/u/rondale_sc)\
**Post date:** [April 26, 2018, 4:53pm UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/21 "2018-04-26T16:53:29Z")

</div>

What is the mechanism to get all the new testing goodness into an older test suite that uses Mocha?

I saw some codemods mentioned for ember-cli-mocha mentioned in @TBieniek’s Emberconf talk, but I’m not sure there is a canonical guide yet.

---

<div class="post-metadata">

**Author:** ![TBieniek](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/tbieniek/32/10937_2.png) [@TBieniek](https://discuss.emberjs.com/u/TBieniek)\
**Post date:** [April 26, 2018, 5:41pm UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/22 "2018-04-26T17:41:00Z")

</div>

there is a beta release for `ember-mocha` (not `ember-cli-mocha`) that includes support for the new testing APIs. I’ve been holding off on releasing it as stable because I was hoping someone would do the work and update the existing [codemod](https://github.com/Turbo87/ember-mocha-codemods) to the new APIs. unfortunately that has not yet happened though.

---

<div class="post-metadata">

**Author:** ![efx](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/efx/32/17920_2.png) [@efx](https://discuss.emberjs.com/u/efx)\
**Post date:** [May 2, 2018, 2:23pm UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/23 "2018-05-02T14:23:12Z")

</div>

Thanks for posting that link. The moved video is here: [- YouTube](https://www.youtube.com/watch?v=dhfTPJJXuJ4&feature=youtu.be). Unfortunately that link does not include the actual testing talk part.

---

<div class="post-metadata">

**Author:** ![Gaurav0](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/gaurav0/32/4704_2.png) [@Gaurav0](https://discuss.emberjs.com/u/Gaurav0)\
**Post date:** [May 2, 2018, 4:59pm UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/24 "2018-05-02T16:59:07Z")

</div>

> [@Alonski](#):
>
> We have a quite large multi year app. We have 0 tests. At this point we don’t know where to get started! I’d love a few pointers on getting started

I would start with:

1. install ember-cli-mirage
2. Create fixtures for your most common api calls, especially those already made when you start up your app.
3. Setup route handlers to return those fixtures in mirage/config.js
4. Create a simple acceptance test that does visit(‘/’) and get it to pass.
5. Start adding unit tests for commonly used services.
6. Start adding component integration tests for your ‘leaf’ components, components that do not contain components inside them.
7. Look through your utils and helpers for simple testable functions and write unit tests for those.
8. As you get practiced at writing tests, start writing tests for whatever bugs you are fixing and whatever features you are implementing while continuing to backfill tests.
9. Once you are at a certain point where you feel comfortable, start looking into factories and models and serializers with Mirage. Start working on getting your app working in ‘Mirage mode’ where all your backend calls are instead faked by Mirage. As you do this, it will become easier to write acceptance tests.
10. Write a few acceptance tests for the most critical flows in your app.
11. At this point, start requiring tests with every PR as part of your code review process.

Good luck. It’s very much worth it when you can make a change with confidence you haven’t broken stuff. And especially when you can do a major refactor without fear.

---

<div class="post-metadata">

**Author:** ![ef4](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/ef4/32/13470_2.png) [@ef4](https://discuss.emberjs.com/u/ef4)\
**Post date:** [May 2, 2018, 5:18pm UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/25 "2018-05-02T17:18:59Z")

</div>

I know they had some technical issues with the streaming, but maybe @samselikoff managed to salvage the video or audio from Rob’s talk?

---

<div class="post-metadata">

**Author:** ![rwjblue](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/rwjblue/32/9411_2.png) [@rwjblue](https://discuss.emberjs.com/u/rwjblue)\
**Post date:** [May 2, 2018, 6:14pm UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/26 "2018-05-02T18:14:21Z")

</div>

Ya, we did record it (ended up recording locally as a backup). I gave a copy to @ryanto last Friday, but I’m guessing it’s a bit of work to polish up…

---

<div class="post-metadata">

**Author:** ![Alonski](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/alonski/32/12542_2.png) [@Alonski](https://discuss.emberjs.com/u/Alonski)\
**Post date:** [May 2, 2018, 7:26pm UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/27 "2018-05-02T19:26:23Z")

</div>

Thank you so much! I still definitely be going over your suggestions with my team

---

<div class="post-metadata">

**Author:** ![samselikoff](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/samselikoff/32/16581_2.png) [@samselikoff](https://discuss.emberjs.com/u/samselikoff)\
**Post date:** [May 2, 2018, 9:37pm UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/28 "2018-05-02T21:37:33Z")

</div>

Sorry all - team EmberMap is at a conference this week and we’ve been busy, but we’ll update the talk soon and post here!

---

<div class="post-metadata">

**Author:** ![pixelhandler](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/pixelhandler/32/18649_2.png) [@pixelhandler](https://discuss.emberjs.com/u/pixelhandler)\
**Post date:** [May 3, 2018, 7:46pm UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/29 "2018-05-03T19:46:17Z")

</div>

@rwjblue I think a question came up regarding testing drag and drop. We’re using ember-sortable and adding support to our feature to use keyboard for A11y and power users. In the test it’s easy to trigger the keyboard commands to facilitate sorting. I know that’s not testing drag and drop but it is testing our sortable feature in a simple way. My recommendation is to look for opportunities to use A11y to push for keyboard solutions as they are testable too 🙂

---

<div class="post-metadata">

**Author:** ![ef4](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/ef4/32/13470_2.png) [@ef4](https://discuss.emberjs.com/u/ef4)\
**Post date:** [May 4, 2018, 6:01am UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/30 "2018-05-04T06:01:55Z")

</div>

[Ember NYC has now posted the full talk.](https://www.youtube.com/watch?v=PwQAj5UU9ng)

---

<div class="post-metadata">

**Author:** ![Henry](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/henry/32/16850_2.png) [@Henry](https://discuss.emberjs.com/u/Henry)\
**Post date:** [May 4, 2018, 9:15am UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/31 "2018-05-04T09:15:52Z")

</div>

What’s the difference between `ember-mocha` and `ember-cli-mocha`?

---

<div class="post-metadata">

**Author:** ![TBieniek](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/tbieniek/32/10937_2.png) [@TBieniek](https://discuss.emberjs.com/u/TBieniek)\
**Post date:** [May 4, 2018, 9:46am UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/32 "2018-05-04T09:46:20Z")

</div>

as posted on [Anything blocking deploying the new testing API? · Issue #205 · emberjs/ember-mocha · GitHub](https://github.com/emberjs/ember-mocha/issues/205#issuecomment-386423604) yesterday:

> at this point `ember-cli-mocha` is just a legacy wrapper that will eventually go away.

the same is true for `ember-cli-qunit`. the reason why they still exist is that some other packages (including Ember itself) rely on those package names to determine what testing framework is being used. we have updated all known packages to be compatible with `ember-qunit` and `ember-mocha`, but wanted to give users a bit more time to update to those adjusted releases.

---

<div class="post-metadata">

**Author:** ![kellyselden](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/kellyselden/32/13835_2.png) [@kellyselden](https://discuss.emberjs.com/u/kellyselden)\
**Post date:** [May 4, 2018, 4:57pm UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/33 "2018-05-04T16:57:03Z")

</div>

Is it expected that to use the new test syntax in an addon, I would have to drop ember 1.13 support?

---

<div class="post-metadata">

**Author:** ![rwjblue](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/rwjblue/32/9411_2.png) [@rwjblue](https://discuss.emberjs.com/u/rwjblue)\
**Post date:** [May 4, 2018, 5:43pm UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/34 "2018-05-04T17:43:15Z")

</div>

> [@kellyselden](#):
>
> Is it expected that to use the new test syntax in an addon, I would have to drop ember 1.13 support?

The newer style tests `setupRenderingTest` / `setupApplicationTest` / `setupTest` require Ember 2.4 or higher.

---

<div class="post-metadata">

**Author:** ![Josh\_Bailey](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/josh_bailey/32/13766_2.png) [@Josh\_Bailey](https://discuss.emberjs.com/u/Josh_Bailey)\
**Post date:** [October 16, 2018, 11:42am UTC](https://discuss.emberjs.com/t/testing-example-issues/14607/35 "2018-10-16T11:42:56Z")

</div>

@TBieniek Thanks for the engine testing workaround, this seems to get integration tests working for my app too. However, I had to add a couple lines, posting here in case anyone else runs into issues:

```
import Resolver from 'dummy/resolver';
import engineResolverFor from 'ember-engines/test-support/engine-resolver-for';

let engineResolver = engineResolverFor('engine-name');

const resolver = Resolver.extend({
  resolve() {
    let resolved = this._super(...arguments);
    if (resolved) {
      return resolved;
    }

    this.namespace.modulePrefix = 'engine-name';

    return engineResolver.resolve(...arguments);
  },
}).create({
  namespace: {
    modulePrefix: 'dummy'
  }
});

```

Basically, I needed to create the Resolver with a `namespace` object with a `modulePrefix` prop. I believe the [commit removing the fallback to the `DefaultResolver`](https://github.com/ember-cli/ember-resolver/commit/c77449d54360cff56c2adeebe1f6d400f9c8f4d9#diff-7152de95c2a2f81b642ddbfb3429ae5d) in `ember-resolver` changed the semantics somewhat

[Previous page](https://discuss.emberjs.com/t/testing-example-issues/14607.md?page=1)
