Skip to content
This repository has been archived by the owner on Dec 4, 2017. It is now read-only.

StyleGuide - In Testing #1160

Open
mgechev opened this issue Apr 25, 2016 · 5 comments
Open

StyleGuide - In Testing #1160

mgechev opened this issue Apr 25, 2016 · 5 comments

Comments

@mgechev
Copy link
Member

mgechev commented Apr 25, 2016

To be discussed.

// cc @johnpapa @wardbell


  • Use Jasmine for unit testing.

    Why?: It is well supported and popular in the JavaScript community.

    Why?: It is widely popular in the Angular community. Jasmine is used for testing both AngularJS 1.x and Angular 2.

    Why?: It has up-to-date type definitions so you can have great development experience using TypeScript.

  • Use Karma as test runner.

  • Place integration tests and tests that cover multiple code units into a separate tests directory in your project's root.

  • Use protractor for End-to-End testing.

    Why?: It provides high-level API on top of the Selenium WebDriver and is supported by the Angular core team.

  • Name the End-to-End test files using the following convention: NAME_OF_THE_TESTED_UNIT.e2e.EXT.

@mgechev
Copy link
Member Author

mgechev commented Apr 25, 2016

I suggest to drop the styles of type:

Use [technology placeholder]

Coupling the style guide with specific testing framework, test runner sounds like a bad idea.

e2e.ts extension for e2e tests sounds natural, however, I think we can move the e2e specs to the lazy-loading boundaries they test.

@Foxandxss
Copy link
Member

Coupling the style guide with specific testing framework, test runner sounds like a bad idea.

Totally agree. Also, there are people who don't like Jasmine and use Mocha or something else with success.

@johnpapa
Copy link
Contributor

Good points. Let's consider where we are with testing right now. Today we know how to make this work with karma as the runner and with jasmine as the framework. These are also what the CLI is working with.

I also have a Wallaby runner, which is cool BTW.

I don;t think there is anything wrong with suggesting a set of tools for people to use. In fact, I think most folks just want to know a combination that works so they can grab them and go. With that in mind, I lean towards having the guide indicate we suggest Karma and Jasmine, and here is more info (link to examples) on how to do so. But we love Mocha too ( mocha is my preference ), and we will add more on Mocha later.

@Foxandxss
Copy link
Member

Yes, I would simply tone down this one. Instead of "Use foo", "We recommend foo".

@johnpapa
Copy link
Contributor

johnpapa commented May 1, 2016

With the new terminology in the guide, this would be

Consider using Jasmine ...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants