Sébastien Lucas / Dev wiki
  • Blog Wiki
  • Story book
  • Developers comics
  • Angular
    • Angular CLI + Angular.json
    • ngTemplateOutlet
    • Angular Schematic
    • Interceptor
    • Micro frontend + Mono repo
    • Build a library module
    • Error handling
    • Virtual and infinite scroll
    • Angular i18n
    • Debug Angular
    • Angular LifeCycle Hook
    • Nested forms in Angular
    • Angular Recipes
    • Master component in Angular
    • Perfomance optimization
    • Service Workers + PWA
    • Mobile
    • Electron app / Desktop app
    • Unit test & Angular
      • Unit test recipes (Jasmine / Karma / Angular)
      • Testing services with httpMock
    • Communication between components
    • Angular snippet library
    • Release and version management
    • Angular tutorial selection
    • UI components libraries
    • Angular libraries
    • Angular Tutorials
    • NGRX
      • Angular NGRX / Tips and code examples
      • Angular new Redux (alternative to ngrx)
      • NGRX unit test
      • Angular ngrx / Basics
    • Angular 2/Angular 1 differences
  • Graphql
  • Three.js
  • Ag grid
  • Open source BIM and 3D
  • Javascript
    • Null vs undefined
    • Html API
    • Await API
    • Debug memory leaks
    • Offline and PWA
    • Javascript tutorials
    • Javascript recipes
    • Bluebird missing docs
    • Alternative to lodash with ES6
    • ES6 syntax the best parts
    • Vanilla JS
  • RXJS
    • Docs
    • Recipes
    • Mock API and sandbox
    • Observables rxjs recipes
    • Combination operators
  • NODE.js
    • Environment variables
    • Fix CORS
    • Pagination requests in API
    • API tests
    • Node.js security
    • Learn node.js
    • Best libraries for node.js
    • Mongoose recipe
    • Debug node.js
  • Gatsby / React
    • Hooks
    • React concepts
    • Gatsby internationalisation
  • Ghost blog
  • Services for developers
    • SaaS images services
    • Airtable API examples
  • MISC
    • JIRA debugging
    • Wordpress plugins
    • Interview Sébastien Lucas
    • English expression
    • True recipes
    • Science podcast
  • AI
    • Machine learning open source
    • Tensor flow
    • Machine learning
    • Code examples
    • Courses and tutorials
    • Datasets
    • The Future of AI
    • Learn algo and data structures
  • Typescript
    • Generic types
    • Typescript recipes
    • Advanced types
      • Conditional types
      • Type guards
    • d.ts files
  • Docker
    • Starting with docker
    • Dockerise simple node app
    • Docker by aymen el amri
  • Mongodb
    • Pattern and data modeling
  • Devops
    • Heroku
    • Scaleway
    • Github template
    • Gitlab CI
    • http2
    • nginx
    • zsh
    • CI Continuous integration
    • DNS
    • Devops resources
    • Gcloud useful commands
    • Authenticate Gcloud
    • Documentation generators
    • Firebase database
  • Developers ressources
    • Online platform coding
      • Online courses
      • Coding games
      • Coding test platforms
      • Links to check
    • Good developers blogs
    • Nice open source project / github
  • Tooling
    • The chrome urls
    • Linux Mac tips
    • Webstorm configuration
    • Develop in Windows
    • Mac debug hardware
    • Mac Setup for a developer
    • Chrome extension
    • Develop toolbox
  • HTML / CSS
    • Tailwind
    • Css grid
    • ☘️Nice styles & generators
    • Favicon
    • Flexbox grid
    • Flexbox layout
    • PUG templates tips
    • Html and css references
    • Css snippets
    • SASS-CSS libraries
    • New things in scss
    • SASS best practices
    • Style lint
  • Tests
    • Cypress
      • Learn cypress and more tests
      • Cypress commands
      • Cypress plugins
      • Page object && app actions
      • Flaky tests
    • Mobile test
    • BDD + Cucumber
    • Puppeteer
    • Type of tests + Ressources
    • Jasmine test
    • Mock, fake, stub in unit tests
    • E2e tests with protactor
    • Mocha
  • REVIT & AEC tools
  • Git
    • Git commits
    • Git tips
    • Git hooks
    • Set up a mono repo
  • Design Pattern
    • Functional Programming
  • Job board / Remote jobs
  • SVG
  • JSON
  • Github
    • Forking a github repo
  • NPM
    • Private NPM packages
    • Publish to NPM with np
  • Yarn
    • Yarn evolution / 2, 3...
    • Yarn Linking
Powered by GitBook
On this page
  • Tutorials on testing
  • DebugElement vs fixture.debugElement
  • Asynchronous problems
  • Mocking dependencies
  • Testing services
  • Overriding component : Testing component with child component
  • Testing ngrx
  • Debugging test

Was this helpful?

  1. Angular

Unit test & Angular

PreviousElectron app / Desktop appNextUnit test recipes (Jasmine / Karma / Angular)

Last updated 5 years ago

Was this helpful?

Tutorials on testing

  • The best tutorials suite (video + code) on Angular testing

  • Rangle.io very clear book on angular included testing

  • Official document in angular site

  • Practical tutorial in the context of angular

  • What is unit test and continuous integration

  • unit testing angular (Jasmine + Karma)

  • A bit old but great description of 3 types of tests to angular components by Victor Savkin

  • Angular testing recipes

A repository to an app with many testing case ordered by type

  • Angular testing guide : good practicle documentation of test per types (component, service, pipes....)

In this article he explain 3 types of components testing :

  • isolated tests are a great way to test drive your components and test complex logic.

  • Shallow tests are isolated tests on steroids, and they should be used when writing a meaningful test requires to render a component’s template.

  • Integration tests verify that a group of components and services (e.g., the router) work together.

  • Testing component by rangle.io

DebugElement vs fixture.debugElement

  • 2 Ways to access the DOM inside unit test in angular

  • The code Of Debug element a wrapper on DOM API

Asynchronous problems

Mocking dependencies

  • Good tutorial on the various strategy of mock....

Testing services

Overriding component : Testing component with child component

Testing ngrx

Debugging test

  • Console.log

  • open a chrome debugger in the karma launched chrome window a trick is that the error messages are something difficult to understand because of the fact that it refere to compile code transformed in ES5 like

    at Object.reducer (webpack:///./src/app/platform/applicability/store/reducers/applicability.reducer.ts?:104:73)

so

  • by opening the chrome debugger

  • going to

A question on tick and whenStable / How to deal with async data

More about async

About using async and zone.js

Difference between async and test async

testing async as if there were not

guide sur les tests asynchrones en francais

Spying and mocking service

Testing services with HttpTestingController

Testing service with

The same technic as explained in the angular test guide official

Override component in rangle.io tuto

Rangle.io version

Todd motto ultimate angular

Todd motto ultimate angular branch with test

https://codecraft.tv/courses/angular/unit-testin
https://angular-2-training-book.rangle.io/handout/testing
https://angular.io/guide/testing#testing-utility-apis
https://semaphoreci.com/community/tutorials/testing-components-in-angular-2-with-jasmine
http://taco.visualstudio.com/en-us/docs/unit-test-01-primer
https://codecraft.tv/courses/angular/unit-testing/jasmine-and-karma/
https://vsavkin.com/three-ways-to-test-angular-2-components-dcea8e90bd8d
https://github.com/juristr/angular-testing-recipes
https://medium.com/google-developer-experts/angular-2-testing-guide-a485b6cb1ef0
https://angular-2-training-book.rangle.io/handout/testing/components/
https://stackoverflow.com/questions/37705599/angular2-testing-whats-the-difference-between-a-debugelement-and-a-nativeeleme
https://angular.io/guide/testing#debugelement
https://angular.io/api/core/DebugElement
https://stackoverflow.com/questions/48328292/unit-testing-value-of-observable-returned-from-service-using-async-pipe
http://devblog.ztp.pt/testing-observables-values-when-using-angular-fakeasync/
https://blog.nrwl.io/controlling-time-with-zone-js-and-fakeasync-f0002dfbf48c
https://github.com/juristr/angular-testing-recipes/blob/master/src/app/services/async.service.spec.ts
https://itnext.io/a-quick-tip-on-testing-observables-e2fbdebef4c
https://guide-angular.wishtack.io/angular/testing/unit-testing/unit-test-asynchrone
https://www.ng-conf.org/mocking-dependencies-angular/
https://medium.com/@shashankvivek.7/testing-a-component-with-stub-services-and-spies-in-jasmine-1428d4242a49
https://medium.com/netscape/testing-with-the-angular-httpclient-api-648203820712
https://www.techiediaries.com/angular-testing-httptestingcontroller
http://mylifeandcode.blogspot.fr/2017/03/how-to-mock-out-child-components-in.html
https://angular.io/guide/testing#nested-component-tests
https://angular-2-training-book.rangle.io/handout/testing/components/overriding.html
https://angular-2-training-book.rangle.io/handout/testing/redux/
https://platform.ultimateangular.com/courses/ngrx-store-effects/lectures/3923987
https://github.com/UltimateAngular/ngrx-store-effects-app/tree/27-testing-effects