Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Angular Testing von A bis Z
Fabian Gosebrink
October 11, 2017
Technology
0
180
Angular Testing von A bis Z
AngularDays 2017 in Berlin - Testing from A to Z
Fabian Gosebrink
October 11, 2017
Tweet
Share
More Decks by Fabian Gosebrink
See All by Fabian Gosebrink
fabiangosebrink
0
40
fabiangosebrink
0
68
fabiangosebrink
1
95
fabiangosebrink
0
33
fabiangosebrink
0
110
fabiangosebrink
0
87
fabiangosebrink
0
220
fabiangosebrink
0
37
fabiangosebrink
1
91
Other Decks in Technology
See All in Technology
sugimomoto
1
330
smzksts
0
280
am7cinnamon
2
2.8k
tdys13
5
3.5k
layerx
1
940
ishiayaya
PRO
0
350
satoshirobatofujimoto
0
110
i35_267
0
140
stakaya
13
8.1k
kanaugust
PRO
0
240
torisoup
0
300
recruitengineers
0
120
Featured
See All Featured
ammeep
656
54k
marktimemedia
6
340
morganepeng
17
1.1k
reverentgeek
168
7.2k
lemiorhan
627
42k
bkeepers
321
53k
hannesfritz
27
930
rmw
11
740
edds
56
9.3k
zakiwarfel
88
3.3k
colly
187
14k
shpigford
165
19k
Transcript
A -Z Testing
Fabian Gosebrink
None
None
Agenda Exploring the Tools Unit Testing with Angular Integration Testing
with Angular End 2 End Testing with Angular Test Driven Development
Testing
UnitTesting
ShallowTesting
INtegrationTesting
End 2 End Testing
Strategies
SmallesT as Possible
REadable
Do Not Mock...
...That Often
Test Driven
Explore the tools
Explore the tools Protractor Jasmine Karma
Jasmine • Behaviour Driven Development • Fast
None
None
None
Some Jasmine Matchers expect(array).toContain(member); expect(mixed).toBeDefined(); expect(mixed).toBeFalsy(); expect(mixed).toBeNull(); expect(mixed).toBeTruthy(); expect(mixed).toBeUndefined(); expect(mixed).toEqual(mixed);
expect(mixed).toMatch(pattern); expect(number).toBeCloseTo(number, decimalPlaces); expect(number).toBeGreaterThan(number); expect(number).toBeLessThan(number); expect(number).toBeNaN(); expect(spy).toHaveBeenCalled(); expect(spy).toHaveBeenCalledTimes(number); expect(spy).toHaveBeenCalledWith(...arguments);
None
None
Skip Tests
Karma • Test runner • Spawns browser & runs tests
• Also on CommandLine
None
None
Protractor • End-to-end test framework • Runs in a real
browser • Test like a user
Testing
Component.ts
Component.spec.ts
AngularCLI
None
None
None
ARRANGE ACT ASSERT
None
Testing Pipes
None
Testing Services
None
None
None
Testing Services ASYNC
None
None
None
Code...
Testing Routing
None
None
Testing Components
Code...
None
https://github.com/FabianGosebrink/AngularDays-2017 https://offering.solutions https://swissangular.com @FabianGosebrink
Links https://medium.com/google-developer-experts/angular-2-testing-guide-a485b6cb1ef0 https://blog.thoughtram.io/angular/2016/12/27/angular-2-advance-testing-with-custom- matchers.html https://blog.nrwl.io/essential-angular-testing-192315f8be9b https://vsavkin.com/three-ways-to-test-angular-2-components-dcea8e90bd8d https://medium.com/letsboot/angular-end-to-end-testing-c3b9950fdd41 https://developers.livechatinc.com/blog/testing-angular-2-apps-routeroutlet-and-http/ https://jasmine.github.io/edge/introduction.html#section-Included_Matchers