













Stockholm syndrome


"Premature optimization is the root of all evil"
Donald Knuth
When testing makes no sense
Miro Svrtan
@msvrtan








When should we write tests?
High cost to fix?
Cost of fixing > cost of testing

When it brings "value"
Value = benefit - cost



Value = benefit - cost
Fallacy #1:
It makes my project more expensive
Do you charge for manual testing?
Bugs cost too

Ask for forgiveness, not permission
Fallacy #2:
It takes a lot of time
learning != using
Fallacy #3:
It takes extra time
Manual testing takes time as well
Fallacy #4:
ship PoC to production
Feature lifecycle
Phase 1: Exploration
Phase 2: Modelling/architecture
Phase 3: Development
Phase 4: Production
Fallacy #5:
100% code coverage
class User
{
...
function isAdmin() : bool{
return $this->admin;
}
...
}
Fallacy #6:
we have "tests"

Fallacy #7:
writing tests later is OK

class User
{
...
function shouldChargeVat() : bool{
if($this->isCompany()){
return false;
}
return true;
}
...
}
Fallacy #8:
TDD has something to do with testing

Fallacy #9:
TDD all the way
Easier onboarding

Easier to add new features

class User
{
...
function shouldChargeVat() : bool{
if($this->isCompany()){
return false;
}
return true;
}
...
}
class User
{
...
function shouldChargeVat() : bool{
if(true === $this->isCompany()){
if('PT' === $this->country){
return true;
}else{
return false;
}
}
return true;
}
...
}
Easier refactoring

class User
{
...
function shouldChargeVat() : bool{
if(true === $this->isCompany()){
if('PT' === $this->country){
return true;
}else{
return false;
}
}
return true;
}
...
}
class User
{
...
function shouldChargeVat() : bool{
if('PT' === $this->country){
return true;
}
if(true === $this->isCompany()){
return false;
}
return true;
}
...
}
class User
{
...
function shouldChargeVat() : bool{
if('PT' === $this->country){
return true;
}
if(true === $this->isCompany()){
return false;
}
return true;
}
...
}
class User
{
...
function shouldChargeVat() : bool{
if(true === $this->isCompany()){
if('PT' === $this->country){
return true;
}else{
return false;
}
}
return true;
}
...
}
Easier rewriting


Cleaner code

It's hard to test
shitty code
Small app

One off app

Exploration phase

Job security




Thank you!
Miro Svrtan
@msvrtan

Feedback -> https://joind.in/talk/ef325
miro (at) mirosvrtan.me

Questions?
@msvrtan
When testing makes no sense (SymfonyCon 2018)
By Miro Svrtan
When testing makes no sense (SymfonyCon 2018)
SymfonyCon 2018
- 2,570