Testing Angular Applications
Joe Eames
Google Developer Expert
@josepheames | joeeames.me
Overview
Unit tests
End-to-end tests
Unit Tests and End to End Tests
End to End Tests
Unit Tests
Test an application action, or user
Test a single “unit”. Method/class. story.
Fast to execute, easy to write. Slow to execute, more difficult to
write.
Testing Pyramid
E2E
Tests
Functional /
Integration Tests
Unit Tests
Assure code works as written
Benefits of Unit Easy to test unusual conditions
Testing Easy to test all code branches
Stop regression bugs
Assure units work together
Benefits of End to Test actual app functionality that users care
End Testing about
Stop regression bugs
Defining Inputs
export class Details {
@Input() lineItem: LineItem;
getTotal() {
return this.lineItem.qty * this.lineItem.price;
}
}
Summary
Unit tests and end-to-end tests
Running tests
Modifying tests
@josepheames
@jimthecoop
Thanks