# Creating Test Data in Ember Data 1.0

**URL:** <https://discuss.emberjs.com/t/creating-test-data-in-ember-data-1-0/2508>\
**Category:** Ember Data\
**Created:** [September 7, 2013, 6:29pm UTC](https://discuss.emberjs.com/t/creating-test-data-in-ember-data-1-0/2508 "2013-09-07T18:29:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![noelrap](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/noelrap/32/14273_2.png) [@noelrap](https://discuss.emberjs.com/u/noelrap)\
**Post date:** [September 7, 2013, 6:29pm UTC](https://discuss.emberjs.com/t/creating-test-data-in-ember-data-1-0/2508/1 "2013-09-07T18:29:36Z")

</div>

In Ember Data pre-1.0, you could access `createRecord` directly from the class being created.

In Ember Data 1.0, you need a store object that is embedded in a controller or route.

Okay, but lets say I want to create a single record for the purposes of unit testing a model – what’s best way to get a data store so that I can create a record? I see the Ember Data tests using a utility method called `createStore` – is that the way to go? What’s the best way to load that into my tests?

---

<div class="post-metadata">

**Author:** ![noelrap](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/noelrap/32/14273_2.png) [@noelrap](https://discuss.emberjs.com/u/noelrap)\
**Post date:** [September 7, 2013, 6:36pm UTC](https://discuss.emberjs.com/t/creating-test-data-in-ember-data-1-0/2508/2 "2013-09-07T18:36:53Z")

</div>

At the moment, I’m using

```
store = App. __container__.lookup('store:main');

```

Which I don’t love. Anything better?

---

<div class="post-metadata">

**Author:** ![abobwhite](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/abobwhite/32/15085_2.png) [@abobwhite](https://discuss.emberjs.com/u/abobwhite)\
**Post date:** [September 11, 2013, 9:24pm UTC](https://discuss.emberjs.com/t/creating-test-data-in-ember-data-1-0/2508/3 "2013-09-11T21:24:17Z")

</div>

I, too, am in need of creating models for the purposes of unit testing…could you provide a real example of what you’re doing with:

> [@noelrap](#):
>
> store = App. **container**.lookup(‘store:main’);

---

<div class="post-metadata">

**Author:** ![JulianLeviston](https://avatars.discourse-cdn.com/v4/letter/j/958977/32.png) [@JulianLeviston](https://discuss.emberjs.com/u/JulianLeviston)\
**Post date:** [October 11, 2013, 7:07am UTC](https://discuss.emberjs.com/t/creating-test-data-in-ember-data-1-0/2508/4 "2013-10-11T07:07:49Z")

</div>

Yeah I agree… the `App. __container__.lookup('store:main')` “idiom” (for want of a better word) either keeps crashing my browser, or is not working at all.

Using Ember Data 1.0.0 I don’t actually know how one _can_ unit test models. This pretty much completely sucks for me because I’m trying to do test driven development and also write some regression tests against some highly recursive data structures. I’ve looked at the ember data source, the ember source and also the disqus source some, but I find them _way_ too complicated for my current level of understanding.
