Skip to content
This repository has been archived by the owner on Mar 22, 2019. It is now read-only.

Initial PR for ember testing guide redux #1401

Merged
merged 69 commits into from
Apr 14, 2014
Merged

Initial PR for ember testing guide redux #1401

merged 69 commits into from
Apr 14, 2014

Conversation

coderberry
Copy link

Below are the examples I would like to add into these docs. If you are interested in helping, please leave a comment of which you are writing and also with the jsbin once it's completed.

Here is an example of a JSBIN with qunit testing. Please use it as a template for your examples: http://jsbin.com/mexar

Please join the IRC channel #emberjs-testing for further discussions on these examples.

Integration Tests

Unit Tests

Controllers

Routes

  • Testing functions
  • Testing actions
  • Testing different callbacks (beforeModel/afterModel/etc)

Handlebars Helpers

Models

Views

  • Testing functions
  • Testing computed properties
  • Testing rendered content (template)
  • Testing interaction (click/etc)

Components

@mattjmorrison
Copy link
Contributor

This is awesome. I think it would be really great to see some of these examples in embedded jsbins in the docs.

@coderberry
Copy link
Author

@mattjmorrison that's the plan 👍

@stefanpenner
Copy link
Member

Sick!

@kiwiupover
Copy link
Contributor

So good thanks for all the hard work on this.

@trek
Copy link
Member

trek commented Mar 26, 2014

We should discuss the helpers for mocking requests. There was a long discussion on discuss.emberjs and people had strong opinions that led to the httpRespond helper, which doesn't tie to any particular ajax library dependency. This will be even more important when we make jquery an optional dep

@dodeja
Copy link

dodeja commented Mar 26, 2014

YUM. 👍

@jdjkelly
Copy link
Contributor

👍 I can help tackle this.

@gmile
Copy link
Contributor

gmile commented Mar 26, 2014

Love, peace and understanding. This is just sick. Once this surfaces on master, I'm all in to starting doing something in ember.js.

@cavneb man, I don't know you, but you certainly rock.

@coderberry
Copy link
Author

I will provide a couple of examples shortly to provide a template we can use.

@gmile - Thanks 😄
@trek - I was thinking of having docs show usage of ic-ajax initially but I will do whatever you recommend.

@toranb
Copy link

toranb commented Mar 27, 2014

@cavneb excellent work on this!!! Should we add subnav to the xhr section to show several examples? Many teams might be comfortable w/ sinon/ic-ajax/etc and it might be worth showing several examples

Also - is it possible we could add a test-runner section? showing both testem and karma ?

@mattjmorrison
Copy link
Contributor

👍 @toranb on the test-runner section. I think that can be a barrier sometimes for new folks that want to know not only how to write tests but how to integrate actually running them into their development workflow.

@coderberry
Copy link
Author

Confirm. Let's stub it out and get content in place. We can smooth it out later.

On Thu, Mar 27, 2014 at 10:14 AM, mattjmorrison notifications@github.com
wrote:

👍 @toranb on the test-runner section. I think that can be a barrier sometimes for new folks that want to know not only how to write tests but how to integrate actually running them into their development workflow.

Reply to this email directly or view it on GitHub:
#1401 (comment)

@mattjmorrison
Copy link
Contributor

@cavneb forgive my ignorance for the following question. I will gladly stub those sections out, do I do that and submit a PR to your fork, or what is the preferred way to do that?

@coderberry
Copy link
Author

Good question. For now submit PR's to my fork but as soon as I can I'll get it on the ember account so we can submit PR's to a branch on there.

On Thu, Mar 27, 2014 at 10:20 AM, mattjmorrison notifications@github.com
wrote:

@cavneb forgive my ignorance for the following question. I will gladly stub those sections out, do I do that and submit a PR to your fork, or what is the preferred way to do that?

Reply to this email directly or view it on GitHub:
#1401 (comment)

@jagthedrummer
Copy link
Contributor

I'm going to take a stab at writing some jsbins for the section on models.

@jagthedrummer
Copy link
Contributor

I opened a PR for a first pass at some model tests. Wanted to make sure I'm on the right track.

https://github.com/cavneb/website/pull/4

Eric Berry and others added 2 commits March 28, 2014 09:14
@coderstash
Copy link

@JulianLeviston Thanks for all the proofing You've done us all a great service.

@kingpin2k
Copy link
Contributor

whew, can't say thanks enough to people proofreading... deep down I hope you're doing it at work somewhere and getting paid for it ;)

@kingpin2k
Copy link
Contributor

Daily ruffle feathers question, does anyone feel like I hijacked testing xhr a bit with the promises/run loop info? The run loop/promises in testing is super important, and kind of an underlying issue with testing xhr, but maybe it belongs in Testing Promises/run loop section preceding Testing XHR. Thoughts, concerns, complaints?

@trek
Copy link
Member

trek commented Apr 11, 2014

I'm still nervous about tying the testing for xhr to a specific external dependency

@mattjmorrison
Copy link
Contributor

@trek @kingpin2k I personally don't use ic-ajax but if it will not allow tests to pass without having the Ember.run in the appropriate places, I'm for it. What about having a section for an alternative to ic-ajax, like mockjax (which is what I use), similar to how the test-runners section covers both testem and karma. If there is interest, I would volunteer to write similar examples using mockjax.

@coderstash
Copy link

I agree. If there isnt a standard tool to test xhr's, then maybe we need a section that explores a few external options. Thoughts?

@kingpin2k
Copy link
Contributor

@mattjmorrison Both @coderstash and I use mockjax as well, we're using a one-off that wraps the resolution/rejection in the run loop though. Personally I have no preference, but ic-ajax works out of the box. I'm totally cool with writing it up saying here's a possible solution, although feel free to use xyz (just like we do with qunit)

@GetContented
Copy link

Hey guys, I've been watching a PR develop over at emberjs/ember.js#4655 for the default resolver and I think it probably deserves at least a mention in the testing/debugging section. It's pretty awesome because it explains some of the magic of what ember does behind the scenes which can be super confusing to new people - things such as naming what would be auto-generated controllers slightly incorrectly, etc. It's just generally awesome because it makes Ember more explicit about what it does. I'm not sure about timings and synching up with when they'll both be released, but I'm sure someone has a general strategy for that type of thing.

@coderberry
Copy link
Author

I went through and reviewed all of the pages. The only page I am wary on adding right off the bat is the XHR page. It has awesome content but I think it needs to be flushed out a bit more. This may be better to extract out into a set of blog posts and linked to from within that doc page.

I will be spending the next 30 min pulling all jsbins into my jsbin account so we can have them all in one location. Please contact me before making any more changes to this PR. I think we are ready!!!!

@pixelhandler
Copy link
Contributor

@cavneb, and everyone,nice work on the testing guides!

I just read through the guide, its very complete.

I have one suggestion: breaking apart the RSVP promises and the XHR content into two pages: one for promises and another for AJAX.

@cavneb regarding your concern about the XHR content... In my opinion this testing guide would be incomplete without the AJAX content. I think that moving the XHR content and examples off to a set of blog posts decentralizes the info, may delay adoption of at least a couple pretty good examples for mocking ajax requests. I would keep it in, and as people adopt the proposed solutions just update and iterate on the XHR page within the website testing guide.

@coderberry
Copy link
Author

@pixelhandler good feedback. I agree that it may be complete, however I am unsure there is an "Ember Way" yet. Whatever the guide contains is what we support. It is important that we do have the XHR section (I was the one pushing for it since the beginning) but I don't want to have it tell the users "try this.. or this.. or this.." .. I think that would hinder us more than help. Thoughts?

@kingpin2k
Copy link
Contributor

I complete agree on splitting the ajax/run loop portion of the docs (obviously I'm just restating my previous concern). And probably keep out the xhr portion until the core team has decided on general consensus. That being said, I don't care whether or not either of them go in right now (since I already know how to test with promise and the run loop ;) ).

@coderberry
Copy link
Author

I think we are at a point where we can merge. @trek @stefanpenner @rjackson would you mind reviewing this PR?

@ralph
Copy link

ralph commented Apr 14, 2014

@cavneb Thank you for creating this guide. I've bookmarked this pull request until it gets merged and published on the official website. Very helpful indeed! :)

@coderberry
Copy link
Author

@ralph we should see this go live today

rwjblue added a commit that referenced this pull request Apr 14, 2014
Initial PR for ember testing guide redux
@rwjblue rwjblue merged commit 2c1ec12 into emberjs:master Apr 14, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.