-
Notifications
You must be signed in to change notification settings - Fork 82
Testing
Danilo Hoffmann edited this page Mar 2, 2020
·
3 revisions
- toolbox concept:
- first first: motivation:
- security about changes
- prove code works
- ensure, behavior doesn't change
- after: why do we not do the usual stuff?!
- karma for unit-testing
- protractor for e2e testing
- --> maybe later
- customization requirements:
- tests should be easily adaptable in projects (if they run tests)
- then: explain the tools in depth, link to official documentation
- second: explain scenarios, assign tools to that
- first first: motivation:
- rich command line interface
- explain watch mode and benefits
- patterns
- re-runs
- updating snapshots
- also interactive
- built-in Angular tooling
- all purpose
- module definition
- dependency injection definition
- providers
- overrides
- DummyComponent
- expect().toX
- toMatchInlineSnapshot()
- jest serializers
- jest.each instead of jasmine-data-provider
- mocking calls, stubbing stuff
- provide: instance(mock())
- when().thenReturn()
- when().thenCall()
- verify().once() / .never()
- capture().last()
- provide with useFactory: () => instance(mock(...))
- mocking Components, Pipes, Directives
- just for satisfying dependencies of TestBed
- access to inputs and outputs of components via componentInstance
- testing for RxJS
- time-relevant accordance
- expect().toBeObservable(...)
- schemes:
- |
- -a--
- --(ab)--
- schemes:
- seldomely used
- self-implemented stuff
- ngrxTesting
- effect for tracking actions -> snapshot serializer
- ngRx testing utility
- no real store
- initialize with a store
- override selectors
- Angular Testing async
- async
- fakeAsync with tick
- done callback
- real time
- setTimeout
- fake time
- virtual timers
- TestBed
- ng-mocks
- snapshots
- findAllIshElements & findAllDataTestingIDs
- maybe marbles
- time stuff
- ts-mockito (EventEmitter)
- TestBed
- ts-mockito
- maybe HttpClientTestingModule
- TestBed
- TestStore
- provideX
- marbles
- time-stuff
- TestBed
- TestStore
- what is a selector anyway?!
- TestBed
- TestStore
-
NullInjectorError: StaticInjectorError(DynamicTestModule)[HttpClient]: StaticInjectorError(Platform: core)[HttpClient]: NullInjectorError: No provider for HttpClient!
- service was not mocked
- --> explain how to read it!
- service was not mocked
-
TypeError: Cannot read property 'pipe' of null
- a method yielding an Observable hasn't been mocked with ts-mockito
- --> explain how to read it!
- a method yielding an Observable hasn't been mocked with ts-mockito
-
Object { - "frame": 60, + "frame": 50, "notification": Notification { "error": undefined, "hasValue": true, "kind": "N", "value": LoadProductSuccess { "payload": Object { "product": Object { "sku": "P123", }, }, "type": "[Shopping] Load Product Success", }, }, },
- Page Objects