Test Automation 
Oren Rubin - Testim.io
Who am I?
Who are you? 
● Company specialty? 
o Backend? Frontend? Mobile? 
● Current development? 
o how frequent are the releases? 
● QA or dev team? 
o Write code or manage?
Software Architecture Class 
Q: How to write large scale applications? 
A: You don't, you aim for small reusable 
components
Systems are composed of Units 
Unit A Unit B Unit C
Units have interfaces 
Click HTTP 
Browser Web Server DB
Units are composed of smaller units 
Web 
Server 
DB 
Click 
Browser 
HTML 
JS 
CSS 
a.js b.js
Test each unit separately? 
Browser Web Server DB 
Test A Test B Test C
Test how the units interact? 
Browser Web Server 
Test A 
DB
Test how the units interact? 
Web Server DB 
Test C 
Browser
Test the entire flow? 
Click HTTP 
Browser Web Server DB
Testing Theory - La järɡən 
● Unit Tests 
● Integration Tests 
● End to End Tests 
● Functional Tests 
● Smoke Tests 
● Load Tests 
● Acceptance Test
Testing Theory - La järɡən
Unit vs. Integration vs. E2E
Testing Theory 
Setup Stimuli Assertions Tear down 
Test starts Initial State Some State 
The Assertions can differ: 
Functional, UI, Timing, Memory consumption
Testing Theory 
Black Box 
● Check against the API 
● Can be done by others 
White Box 
● Look inside (gory details) 
● Usually same person
Testing Metrics 
Black Box 
● Users stories 
● Response time 
● Memory consumption 
(memory leaks) 
White Box 
● Code coverage 
● Loop edge cases: 
o Never go in 
o Go in once 
o More than once
Test automation 
Unit Tests
Unit Tests.. find the diffs 
Bad Code 
● Long methods 
● Tightly Coupled 
● Unreadable 
● Hard root cause 
● Use Global 
Good Code 
● Short methods 
● Loose Coupling 
● Readable 
● Easy bug detection 
● Separation of 
Concerns 
Unit Tested Code 
● Short methods 
● Loose Coupling 
● Readable 
● Easy bug detection 
● Separation of 
Concerns
Unit Tests 
Remember: 
Units tests helps you write better code 
Regression tests are a bonus!
Testing Theory - Unit Tests 
Setup Stimuli Assertions Tear down 
Test starts Initial State Some State 
Assertions 
● State changed 
● callbacks (methods) were called
Testing Theory - Unit Tests 
a =new A() a.f() assert(a.x = 5) 
Test starts Initial State Some State 
Assertions 
● State changed 
● callbacks (methods) were called
Test each unit separately? 
mock http 
Browser Web Server DB 
mock timers 
Test A Test B Test C
Unit Isolation 
Spies 
Stubs 
Mocks
Unit Isolation - if needed 
Fake ajax 
Fake timers 
Work asynchronously
Assertion Library
Spies
Spy on functions
Spy on functions
Spy on functions
Spy filters
Spy Assertions
Spy Assertions
Stubs
Stubs
Stubs
Mocks
Jasmine 
● Very simple 
● Great docs: http://pivotal.github.com/jasmine/ 
● Load is by an HTML scaffold 
● Completely standalone 
● Custom Matchers: expect('moshe').toBeMoshe(); 
● Easy to filter tests 
● Nested describe blocks (each has beforeEach)
Jasmine
Jasmine
Jasmine
Sinon
Asynchronous - Jasmine
Jasmine async riddle
TDD 
1. Write test 
2. Test fails 
3. Write code 
4. Test passes 
5. Refactor 
6. Go to 2
Keyword driven tests e.g. cucumber
TDD can apply to Integration and E2E

Test automation expert days

Editor's Notes

  • #4 One important goal is to get to know fellow friends in the industry.. and share knowledge