SlideShare a Scribd company logo
1 of 38
Download to read offline
Achieving “Zero Downtime Deployment” with 
Automated Testing 
Kan Ouivirach 
Poomjai Saeyong 
BugDay Bangkok 2014
ใครมาพูดนะ? 
Kan Ouivirach 
Research & Development Engineer 
kan@prontomarketing.com 
Poomjai Saeyong 
Agile Tester 
boss@prontomarketing.com
หัวข้ออะไรบ้าง? 
• เกริ่นเล็กน้อย 
• เริ่มต้นอย่างไร? 
• Automate กันไปทำเพื่อ? 
• ถาม-ตอบ
Downtime ในมุมมองของใคร?
ปัจจัยที่สำคัญที่สุด
http://theyec.org/
เริ่มต้น?
ขอ 5 ขั้นตอนพอ 
http://inspirationlush.com/
“บนเครื่องผมมันเวิร์คอ่ะ” 
–มิตรสหายท่านหนึ่ง
ขั้นตอนที่ 1 
Development Environment
http://www.digitalforreallife.com/2012/11/boosting-teamwork-with-vagrant/
ขั้นตอนที่ 2 
Test-Driven Development (TDD)
ขั้นตอนที่ 3 
Acceptance Test-Driven 
Development (ATDD)
ขั้นตอนที่ 4 
Continuous Integration (CI)
Build Pipeline
Build Pipeline 
Pull Code
Build Pipeline 
Unit Test
Build Pipeline 
Acceptance Test
Build Pipeline 
Performance Test
Build Pipeline 
Unit Test Again 
after Merge into 
Master
Build Pipeline 
Deploy to Demo
Build Pipeline 
Deploy to Production
ถ้า Build พัง?
เครื่อง Demo (Staging) ก็สำคัญนะเออ 
• จะมี Database เหมือนกับเครื่อง Production ซึ่งเราสามารถ 
ทดสอบ Migration Script ได้ 
• เอาไว้ทดสอบของใหม่ๆ ก่อนเอาเข้า Production
แนวทางปฏิบัติ 
• เก็บโค้ดไว้ที่เดียวกัน ทำงานบน Branch เดียวกัน (สมมุติว่าใช้ Git) 
• เวลาจะแก้ไข หรือเพิ่ม Feature 
1. เอาโค้ดจาก Remote มาเป็น Working Copy บนเครื่อง 
2. เขียนโค้ดเขียนเทสให้เสร็จ 
3. อัพเดท Working Copy จาก Remote ดูว่ามีอะไรเปลี่ยนแปลง 
หรือไม่ 
4. รันเทส ถ้าพังก็แก้ ถ้าไม่พังก็เอาโค้ดเข้า Remote
ทีมควรจะต้อง 
• หมั่น Check-in บ่อยๆ 
• อย่า Check-in โค้ดพัง 
• อย่า Check-in โค้ดที่ไม่มีเทส 
• อย่า Check-in ตอนที่ Build พัง
“Continuous Integration doesn’t get rid of 
bugs, but it does make them dramatically 
easier to find and remove.” 
–Martin Fowler
ขั้นตอนที่ 5 
Automated Deployment
How to lose $172,222 a second for 45 minutes
ขั้นตอน Deployment ของ Mina 
1. สร้าง Folder ใหม่ 
2. เอาโค้ดล่าสุดใส่ Folder นั้น 
3. รัน Database Migration Script 
4. ย้าย Symbolic Link ไปชี้ที่ Directory นั้น
/var/www/welovebug.com/ 
|- releases/ 
|- |- 1/ 
|- |- 2/ 
|- |- 3/ 
|- |- shared/ 
|- current/ 
เอา current มาชี้ตรงนี้ 
เอา Document Root มาชี้ตรงนี้
/var/www/welovebug.com/ 
|- releases/ 
|- |- 1/ 
|- |- 2/ 
|- |- 3/ 
|- |- 4/ 
|- |- shared/ 
|- current/ 
เอาโค้ดใหม่ใส่ที่นี่
/var/www/welovebug.com/ 
|- releases/ 
|- |- 1/ 
|- |- 2/ 
|- |- 3/ 
|- |- 4/ 
|- |- shared/ 
|- current/ 
แล้วย้าย current มาชี้ที่นี่ 
สุดท้ายค่อย Restart Services
Automate กันไปทำเพื่อ?
ส่วนหนึ่งก็เพื่อ 
• ส่งมอบงานที่มีคุณภาพได้เร็วขึ้น และบ่อยขึ้น 
• เอาเวลาไปพัฒนาสิ่งใหม่ๆ แทนที่จะเอาไปแก้บั๊ก 
• ลดความเสียหายที่เกิดจากคน 
• ช่วยทำ Regression Test
ทำให้ถูกตั้งแต่ตอนนี้ 
http://www.xkcd.com/974/
ถาม-ตอบ

More Related Content

Similar to Achieving "Zero Downtime Deployment" with Automated Testing

Thailand SPIN: QA Excellence Workshop
Thailand SPIN: QA Excellence WorkshopThailand SPIN: QA Excellence Workshop
Thailand SPIN: QA Excellence WorkshopNopparat Slisatkorn
 
AutoTesting.pdf
AutoTesting.pdfAutoTesting.pdf
AutoTesting.pdfpsaku1
 
Thailand SPIN: QA Excellence workshop 2014
Thailand SPIN: QA Excellence workshop 2014Thailand SPIN: QA Excellence workshop 2014
Thailand SPIN: QA Excellence workshop 2014Nopparat Slisatkorn
 
คู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i os
คู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i osคู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i os
คู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i osNisachol Poljorhor
 

Similar to Achieving "Zero Downtime Deployment" with Automated Testing (8)

Thailand SPIN: QA Excellence Workshop
Thailand SPIN: QA Excellence WorkshopThailand SPIN: QA Excellence Workshop
Thailand SPIN: QA Excellence Workshop
 
55
5555
55
 
AutoTesting.pdf
AutoTesting.pdfAutoTesting.pdf
AutoTesting.pdf
 
Thailand SPIN: QA Excellence workshop 2014
Thailand SPIN: QA Excellence workshop 2014Thailand SPIN: QA Excellence workshop 2014
Thailand SPIN: QA Excellence workshop 2014
 
Avoiding plagiarism
Avoiding plagiarism Avoiding plagiarism
Avoiding plagiarism
 
คู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i os
คู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i osคู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i os
คู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i os
 
CI/CD
CI/CDCI/CD
CI/CD
 
How to install oracle 12c release 1
How to install oracle 12c release 1How to install oracle 12c release 1
How to install oracle 12c release 1
 

More from Kan Ouivirach, Ph.D.

Adoption of AI: The Great Opportunities for Everyone
Adoption of AI: The Great Opportunities for EveryoneAdoption of AI: The Great Opportunities for Everyone
Adoption of AI: The Great Opportunities for EveryoneKan Ouivirach, Ph.D.
 
Uncover Python's Potential in Machine Learning
Uncover Python's Potential in Machine LearningUncover Python's Potential in Machine Learning
Uncover Python's Potential in Machine LearningKan Ouivirach, Ph.D.
 
WordPress Hooks: The Right Way to Extend Your WordPress
WordPress Hooks: The Right Way to Extend Your WordPressWordPress Hooks: The Right Way to Extend Your WordPress
WordPress Hooks: The Right Way to Extend Your WordPressKan Ouivirach, Ph.D.
 
Lesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at ProntoLesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at ProntoKan Ouivirach, Ph.D.
 
หัดเขียน A.I. แบบ AlphaGo กันชิวๆ
หัดเขียน A.I. แบบ AlphaGo กันชิวๆหัดเขียน A.I. แบบ AlphaGo กันชิวๆ
หัดเขียน A.I. แบบ AlphaGo กันชิวๆKan Ouivirach, Ph.D.
 
What We Do in This Weird Office Culture
What We Do in This Weird Office CultureWhat We Do in This Weird Office Culture
What We Do in This Weird Office CultureKan Ouivirach, Ph.D.
 
Exploring Machine Learning in Python with Scikit-Learn
Exploring Machine Learning in Python with Scikit-LearnExploring Machine Learning in Python with Scikit-Learn
Exploring Machine Learning in Python with Scikit-LearnKan Ouivirach, Ph.D.
 
Thailand Hadoop Big Data Challenge #1
Thailand Hadoop Big Data Challenge #1Thailand Hadoop Big Data Challenge #1
Thailand Hadoop Big Data Challenge #1Kan Ouivirach, Ph.D.
 
Practical Experience in Automated Testing at Pronto Marketing
Practical Experience in Automated Testing at Pronto MarketingPractical Experience in Automated Testing at Pronto Marketing
Practical Experience in Automated Testing at Pronto MarketingKan Ouivirach, Ph.D.
 
Extracting the Object from the Shadows: Maximum Likelihood Object/Shadow Disc...
Extracting the Object from the Shadows: Maximum Likelihood Object/Shadow Disc...Extracting the Object from the Shadows: Maximum Likelihood Object/Shadow Disc...
Extracting the Object from the Shadows: Maximum Likelihood Object/Shadow Disc...Kan Ouivirach, Ph.D.
 
Clustering Human Behaviors with Dynamic Time Warping and Hidden Markov Models...
Clustering Human Behaviors with Dynamic Time Warping and Hidden Markov Models...Clustering Human Behaviors with Dynamic Time Warping and Hidden Markov Models...
Clustering Human Behaviors with Dynamic Time Warping and Hidden Markov Models...Kan Ouivirach, Ph.D.
 
Adapting Scrum to Managing a Research Group
Adapting Scrum to Managing a Research GroupAdapting Scrum to Managing a Research Group
Adapting Scrum to Managing a Research GroupKan Ouivirach, Ph.D.
 

More from Kan Ouivirach, Ph.D. (19)

Adoption of AI: The Great Opportunities for Everyone
Adoption of AI: The Great Opportunities for EveryoneAdoption of AI: The Great Opportunities for Everyone
Adoption of AI: The Great Opportunities for Everyone
 
Uncover Python's Potential in Machine Learning
Uncover Python's Potential in Machine LearningUncover Python's Potential in Machine Learning
Uncover Python's Potential in Machine Learning
 
WordPress Hooks: The Right Way to Extend Your WordPress
WordPress Hooks: The Right Way to Extend Your WordPressWordPress Hooks: The Right Way to Extend Your WordPress
WordPress Hooks: The Right Way to Extend Your WordPress
 
Lesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at ProntoLesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at Pronto
 
หัดเขียน A.I. แบบ AlphaGo กันชิวๆ
หัดเขียน A.I. แบบ AlphaGo กันชิวๆหัดเขียน A.I. แบบ AlphaGo กันชิวๆ
หัดเขียน A.I. แบบ AlphaGo กันชิวๆ
 
Agile and Scrum Methodology
Agile and Scrum MethodologyAgile and Scrum Methodology
Agile and Scrum Methodology
 
Machine Learning at Geeky Base 2
Machine Learning at Geeky Base 2Machine Learning at Geeky Base 2
Machine Learning at Geeky Base 2
 
Machine Learning คือ? #bcbk
Machine Learning คือ? #bcbkMachine Learning คือ? #bcbk
Machine Learning คือ? #bcbk
 
What We Do in This Weird Office Culture
What We Do in This Weird Office CultureWhat We Do in This Weird Office Culture
What We Do in This Weird Office Culture
 
The WordPress Way
The WordPress WayThe WordPress Way
The WordPress Way
 
Exploring Machine Learning in Python with Scikit-Learn
Exploring Machine Learning in Python with Scikit-LearnExploring Machine Learning in Python with Scikit-Learn
Exploring Machine Learning in Python with Scikit-Learn
 
Machine Learning at Geeky Base
Machine Learning at Geeky BaseMachine Learning at Geeky Base
Machine Learning at Geeky Base
 
Thailand Hadoop Big Data Challenge #1
Thailand Hadoop Big Data Challenge #1Thailand Hadoop Big Data Challenge #1
Thailand Hadoop Big Data Challenge #1
 
Pronto R&D Presentation
Pronto R&D PresentationPronto R&D Presentation
Pronto R&D Presentation
 
Scrum at Pronto Marketing
Scrum at Pronto MarketingScrum at Pronto Marketing
Scrum at Pronto Marketing
 
Practical Experience in Automated Testing at Pronto Marketing
Practical Experience in Automated Testing at Pronto MarketingPractical Experience in Automated Testing at Pronto Marketing
Practical Experience in Automated Testing at Pronto Marketing
 
Extracting the Object from the Shadows: Maximum Likelihood Object/Shadow Disc...
Extracting the Object from the Shadows: Maximum Likelihood Object/Shadow Disc...Extracting the Object from the Shadows: Maximum Likelihood Object/Shadow Disc...
Extracting the Object from the Shadows: Maximum Likelihood Object/Shadow Disc...
 
Clustering Human Behaviors with Dynamic Time Warping and Hidden Markov Models...
Clustering Human Behaviors with Dynamic Time Warping and Hidden Markov Models...Clustering Human Behaviors with Dynamic Time Warping and Hidden Markov Models...
Clustering Human Behaviors with Dynamic Time Warping and Hidden Markov Models...
 
Adapting Scrum to Managing a Research Group
Adapting Scrum to Managing a Research GroupAdapting Scrum to Managing a Research Group
Adapting Scrum to Managing a Research Group
 

Achieving "Zero Downtime Deployment" with Automated Testing