SlideShare une entreprise Scribd logo
1  sur  59
A er Acceptance: Reasoning About System Outputs
Dr. Stefanos Zachariadis
@thenewstef
https://moto.co.de
https://cyclema.ps
http://itv.com
InfoQ.com: News & Community Site
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations/
testing-production
• Over 1,000,000 software developers, architects and CTOs read the site world-
wide every month
• 250,000 senior developers subscribe to our weekly newsletter
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• 2 dedicated podcast channels: The InfoQ Podcast, with a focus on
Architecture and The Engineering Culture Podcast, with a focus on building
• 96 deep dives on innovative topics packed as downloadable emags and
minibooks
• Over 40 new content items per week
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Presented at QCon London
www.qconlondon.com
OUTLINE
Issues not typically caught by a CI environment
What we'd like to test a er the acceptance testing
phase
How we can achieve this systematically
WHY ARE WE HERE
actual photo of ATM in Uruguay taken Feb 2017
OH LOOK, TOUCHSCREEN STILL ACTIVE
enum AccountType {
PERSONAL, BUSINESS, PRIVATE
}
public class Account {
private final String name;
private final AccountType type;
}
enum AccountType {
PERSONAL, BUSINESS
}
public class Account {
@NotNull
private final String name;
private final AccountType type;
public boolean equals(Object obj) {
return name.equals(obj.name) &&
type.equals(obj.type);
}
}
public class Account {
private final String name;
private final AccountType type;
private final CurrencyCode currency;
}
@Test
public void getsTheCorrectBalanceAfterADeposit() {
//given
Account account = new Account();
//when
account.deposit(200);
//then
assertEquals(200, account.getBalance());
}
so ware is complicated
class StarWarsMovies {
private boolean[] seen = new boolean[200];
}
2^200 + 1
seen = null;
1 606 938 044 258
990 275 541 962 092
341 162 602 522 202
993 782 792 835 301
376 + 1
testing cannot be exhaustive
continuous delivery of stateful systems is hard
2^200
Check in
Check in
Check in
Trigger
Trigger
Trigger
Trigger
Trigger
Feedback
Feedback
Feedback
Feedback
Feedback
Feedback
Approval
Approval
Delivery team Version control Build & unit
tests
Automated
acceptance tests
User acceptance
tests
Release
@Test
public void getsTheCorrectBalanceAfterADeposit() {
//given
Account account = new Account();
//when
account.deposit(200);
//then
assertEquals(200, account.getBalance());
}
Your current account balance is a result of:
Deposits and withdrawals
Charges and deposits by other actors
Data migrations
Exchange rates
Multiple system releases
over lots of time
WHY IT MAY BREAK
system state
over multiple releases
Check in
Check in
Check in
Trigger
Trigger
Trigger
Trigger
Trigger
Feedback
Feedback
Feedback
Feedback
Feedback
Feedback
Approval
Approval
Delivery team Version control Build & unit
tests
Automated
acceptance tests
User acceptance
tests
Release
A NEW HOPE
WHAT TO TEST
Data validity
All data can be loaded
@Test
public void allAccountsAreReadable() {
final AccountDao accountDao = new AccountDao();
for(User user : users) {
final Account account
= accountDao.loadAccountFor(user);
verify(account);
}
}
Business level validation
@Test
public void accountsBalanceAboveOverdraftLimit() {
for(User user : users) {
Account account =
accountDao.loadAccountFor(user);
assertTrue(account.getBalance()
> NEGATIVE_OVERDRAFT_LIMIT);
}
}
WHAT TO TEST
Data invariance
1. capture invariants
2. upgrade
3. ???
4. verify invariants (& profit)
@Test
public void accountBalanceIsMaintained() {
for(User user : users) {
Account account =
accountDao.loadAccountFor(user);
BigDecimal productionBalance =
prodData.getBalance(account.getId());
assertEqual(productionBalance,
account.getBalance());
}
}
WHAT TO TEST
Migration integrity
@Test
public void allAccountsAreInUSD() {
for(User user : users) {
Account account =
accountDao.loadAccountFor(user);
assertEqual(CurrencyCode.USD,
account.getCurrency())
}
}
WHAT TO TEST
Data volume
@Test
public void generatesARiskReport() {
final AccountDao accountDao = new AccountDao();
final RiskReportGenerator riskReportGenerator =
new RiskReportGenerator(accountDao);
time(riskReportGenerator::make, 60, TimeUnit.MINUTES)
}
DATA SANITISATION
first_name last_name account_id
John Smith 7
↓
first_name last_name account_id
Name 3 Surname 2 7
data migration
Production data → latest commit ?
Data is owned by the application. This means that the
migration process is owned by the application, and
new migrations should ship with the application and be
performed with the deployment of every new version.
latestData = migration(prodData)
1. import the sanitised data that the cleanser
produced
2. capture invariants (e.g. account balances)
3. migrate it to the latest version of the application
4. run the tests
CONSIDERATIONS
fight the power
no downtime
flip it around - send the tests to production
frequency
MORE THAN JUST TESTING
staging
passwords
OH IT CAN BE SO SLOW
Sampling
Incremental updates
Rolling back
CONCLUSIONS
data testing: integration testing of commit with prod
- like data
bring production - like data into your CD pipeline
use a cleanser to make this legal
migration is integral to the application
allows you to catch a whole new category of bugs
facilitates frequent releases
Thank you!
pictures by @thenewstef apart from CD (wikipedia),
Data, Jar Jar, bank of chthulhu (unattributed)
https://moto.co.de
https://cyclema.ps
http://itv.com
Watch the video with slide synchronization on
InfoQ.com!
https://www.infoq.com/presentations/testing-
production

Contenu connexe

Plus de C4Media

Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDC4Media
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine LearningC4Media
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at SpeedC4Media
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsC4Media
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsC4Media
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerC4Media
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleC4Media
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeC4Media
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereC4Media
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing ForC4Media
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data EngineeringC4Media
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreC4Media
 
Navigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsNavigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsC4Media
 
High Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in AdtechHigh Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in AdtechC4Media
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/awaitC4Media
 
Opportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaOpportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaC4Media
 
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayDatadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayC4Media
 
Are We Really Cloud-Native?
Are We Really Cloud-Native?Are We Really Cloud-Native?
Are We Really Cloud-Native?C4Media
 
CockroachDB: Architecture of a Geo-Distributed SQL Database
CockroachDB: Architecture of a Geo-Distributed SQL DatabaseCockroachDB: Architecture of a Geo-Distributed SQL Database
CockroachDB: Architecture of a Geo-Distributed SQL DatabaseC4Media
 
A Dive into Streams @LinkedIn with Brooklin
A Dive into Streams @LinkedIn with BrooklinA Dive into Streams @LinkedIn with Brooklin
A Dive into Streams @LinkedIn with BrooklinC4Media
 

Plus de C4Media (20)

Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CD
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine Learning
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at Speed
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep Systems
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.js
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly Compiler
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix Scale
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's Edge
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home Everywhere
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing For
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data Engineering
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 
Navigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsNavigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery Teams
 
High Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in AdtechHigh Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in Adtech
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/await
 
Opportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaOpportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven Utopia
 
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayDatadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
 
Are We Really Cloud-Native?
Are We Really Cloud-Native?Are We Really Cloud-Native?
Are We Really Cloud-Native?
 
CockroachDB: Architecture of a Geo-Distributed SQL Database
CockroachDB: Architecture of a Geo-Distributed SQL DatabaseCockroachDB: Architecture of a Geo-Distributed SQL Database
CockroachDB: Architecture of a Geo-Distributed SQL Database
 
A Dive into Streams @LinkedIn with Brooklin
A Dive into Streams @LinkedIn with BrooklinA Dive into Streams @LinkedIn with Brooklin
A Dive into Streams @LinkedIn with Brooklin
 

Dernier

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 

Dernier (20)

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 

After Acceptance: Reasoning About System Outputs

  • 1. A er Acceptance: Reasoning About System Outputs Dr. Stefanos Zachariadis @thenewstef https://moto.co.de https://cyclema.ps http://itv.com
  • 2. InfoQ.com: News & Community Site Watch the video with slide synchronization on InfoQ.com! https://www.infoq.com/presentations/ testing-production • Over 1,000,000 software developers, architects and CTOs read the site world- wide every month • 250,000 senior developers subscribe to our weekly newsletter • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • 2 dedicated podcast channels: The InfoQ Podcast, with a focus on Architecture and The Engineering Culture Podcast, with a focus on building • 96 deep dives on innovative topics packed as downloadable emags and minibooks • Over 40 new content items per week
  • 3. Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide Presented at QCon London www.qconlondon.com
  • 4. OUTLINE Issues not typically caught by a CI environment What we'd like to test a er the acceptance testing phase How we can achieve this systematically
  • 5. WHY ARE WE HERE
  • 6.
  • 7.
  • 8.
  • 9. actual photo of ATM in Uruguay taken Feb 2017
  • 10. OH LOOK, TOUCHSCREEN STILL ACTIVE
  • 11.
  • 12. enum AccountType { PERSONAL, BUSINESS, PRIVATE } public class Account { private final String name; private final AccountType type; }
  • 14.
  • 15. public class Account { @NotNull private final String name; private final AccountType type; public boolean equals(Object obj) { return name.equals(obj.name) && type.equals(obj.type); } }
  • 16.
  • 17.
  • 18. public class Account { private final String name; private final AccountType type; private final CurrencyCode currency; }
  • 19.
  • 20.
  • 21.
  • 22. @Test public void getsTheCorrectBalanceAfterADeposit() { //given Account account = new Account(); //when account.deposit(200); //then assertEquals(200, account.getBalance()); }
  • 23. so ware is complicated class StarWarsMovies { private boolean[] seen = new boolean[200]; }
  • 24. 2^200 + 1 seen = null;
  • 25. 1 606 938 044 258 990 275 541 962 092 341 162 602 522 202 993 782 792 835 301 376 + 1
  • 26. testing cannot be exhaustive
  • 27. continuous delivery of stateful systems is hard
  • 28. 2^200
  • 29. Check in Check in Check in Trigger Trigger Trigger Trigger Trigger Feedback Feedback Feedback Feedback Feedback Feedback Approval Approval Delivery team Version control Build & unit tests Automated acceptance tests User acceptance tests Release
  • 30.
  • 31. @Test public void getsTheCorrectBalanceAfterADeposit() { //given Account account = new Account(); //when account.deposit(200); //then assertEquals(200, account.getBalance()); }
  • 32. Your current account balance is a result of: Deposits and withdrawals Charges and deposits by other actors Data migrations Exchange rates Multiple system releases over lots of time
  • 33. WHY IT MAY BREAK system state over multiple releases
  • 34. Check in Check in Check in Trigger Trigger Trigger Trigger Trigger Feedback Feedback Feedback Feedback Feedback Feedback Approval Approval Delivery team Version control Build & unit tests Automated acceptance tests User acceptance tests Release
  • 35.
  • 37. WHAT TO TEST Data validity
  • 38. All data can be loaded @Test public void allAccountsAreReadable() { final AccountDao accountDao = new AccountDao(); for(User user : users) { final Account account = accountDao.loadAccountFor(user); verify(account); } }
  • 39. Business level validation @Test public void accountsBalanceAboveOverdraftLimit() { for(User user : users) { Account account = accountDao.loadAccountFor(user); assertTrue(account.getBalance() > NEGATIVE_OVERDRAFT_LIMIT); } }
  • 40. WHAT TO TEST Data invariance 1. capture invariants 2. upgrade 3. ??? 4. verify invariants (& profit)
  • 41. @Test public void accountBalanceIsMaintained() { for(User user : users) { Account account = accountDao.loadAccountFor(user); BigDecimal productionBalance = prodData.getBalance(account.getId()); assertEqual(productionBalance, account.getBalance()); } }
  • 42. WHAT TO TEST Migration integrity @Test public void allAccountsAreInUSD() { for(User user : users) { Account account = accountDao.loadAccountFor(user); assertEqual(CurrencyCode.USD, account.getCurrency()) } }
  • 43. WHAT TO TEST Data volume @Test public void generatesARiskReport() { final AccountDao accountDao = new AccountDao(); final RiskReportGenerator riskReportGenerator = new RiskReportGenerator(accountDao); time(riskReportGenerator::make, 60, TimeUnit.MINUTES) }
  • 44.
  • 45.
  • 46.
  • 47. DATA SANITISATION first_name last_name account_id John Smith 7 ↓ first_name last_name account_id Name 3 Surname 2 7
  • 48.
  • 49. data migration Production data → latest commit ?
  • 50. Data is owned by the application. This means that the migration process is owned by the application, and new migrations should ship with the application and be performed with the deployment of every new version. latestData = migration(prodData)
  • 51. 1. import the sanitised data that the cleanser produced 2. capture invariants (e.g. account balances) 3. migrate it to the latest version of the application 4. run the tests
  • 52.
  • 53. CONSIDERATIONS fight the power no downtime flip it around - send the tests to production frequency
  • 54. MORE THAN JUST TESTING staging passwords
  • 55. OH IT CAN BE SO SLOW Sampling Incremental updates Rolling back
  • 56. CONCLUSIONS data testing: integration testing of commit with prod - like data bring production - like data into your CD pipeline use a cleanser to make this legal migration is integral to the application allows you to catch a whole new category of bugs facilitates frequent releases
  • 57.
  • 58. Thank you! pictures by @thenewstef apart from CD (wikipedia), Data, Jar Jar, bank of chthulhu (unattributed) https://moto.co.de https://cyclema.ps http://itv.com
  • 59. Watch the video with slide synchronization on InfoQ.com! https://www.infoq.com/presentations/testing- production