Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Day 1 - Testing
Search
offz
April 19, 2017
Programming
0
47
Day 1 - Testing
Automate software testing with Java for beginner.
offz
April 19, 2017
Tweet
Share
More Decks by offz
See All by offz
TM-P2-IT-security
offfffz
0
23
Docker Compose for Rails Developer
offfffz
1
36
Day 2 - Docker
offfffz
0
44
Day 2 - CI
offfffz
0
56
Day 1 - Git
offfffz
0
89
Other Decks in Programming
See All in Programming
Select API from Kotlin Coroutine
jmatsu
1
230
Rubyでやりたい駆動開発 / Ruby driven development
chobishiba
1
650
“いい感じ“な定量評価を求めて - Four Keysとアウトカムの間の探求 -
nealle
1
8.5k
Kotlin エンジニアへ送る:Swift 案件に参加させられる日に備えて~似てるけど色々違う Swift の仕様 / from Kotlin to Swift
lovee
1
260
PHP 8.4の新機能「プロパティフック」から学ぶオブジェクト指向設計とリスコフの置換原則
kentaroutakeda
2
750
LINEヤフー データグループ紹介
lycorp_recruit_jp
0
2.3k
Goで作る、開発・CI環境
sin392
0
220
生成AI時代のコンポーネントライブラリの作り方
touyou
1
110
Node-RED を(HTTP で)つなげる MCP サーバーを作ってみた
highu
0
120
データの民主化を支える、透明性のあるデータ利活用への挑戦 2025-06-25 Database Engineering Meetup#7
y_ken
0
340
Google Agent Development Kit でLINE Botを作ってみた
ymd65536
2
220
既存デザインを変更せずにタップ領域を広げる方法
tahia910
1
280
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
53k
For a Future-Friendly Web
brad_frost
179
9.8k
Balancing Empowerment & Direction
lara
1
410
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
52k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
Making the Leap to Tech Lead
cromwellryan
134
9.4k
Bash Introduction
62gerente
614
210k
Transcript
Testing….
ความเชื่อผิดๆ - เขียน Test ทำให้ทำงานช้าลง - เขียน Test แล้วงานเพิ่มขึ้น ได้เงินเท่าเดิม
เขียน Test ทำให้ทำงานช้าลง
งานเพิ่ม เงินเท่าเดิม - ที่งานเยอะ ไม่ใช่เพราะ feature แต่เพราะ bug - fix
bug เหนื่อยกว่าทำ feature - context switching cost แพงมาก
Now
ทำไมต้อง Test ? - เพื่อความมั่นใจ - เพื่อชื่อเสียง - เพื่อเงิน
ใครต้อง Test ? - คนที่เขียน code นั้นๆ - คนที่เก่งเรื่องจับผิด -
คนที่จ่ายเงิน
วิธีการ Test ? 1. ทำ software ให้เสร็จ 2. ติดตั้งลงในสภาพแวดล้อมจำลอง 3.
click ไปเรื่อยๆ จนกว่ามันจะพัง
Future
งานซ้ำๆ ให้คอมทำเร็วกว่า
วิธีการ Test class Calculator { public int plus(int a, int
b) { return a + b; } } class CalculatorTests { public boolean testPlus() { Calculator calculator = new Calculator(); int result = calculator.plus(1, 2); return result == 3; } }
วิธีการ Test class TestMain { public static void main(String[] args)
{ CalculatorTests suit = new CalculatorTests(); if (suit.testPlus) { System.out.println("You survive!"); } else { System.out.println("You died!"); System.exit(-1); } } }
เครื่องมือ Test
JUnit Test class CalculatorTests { Calculator calculator; @Before public void
setup() { calculator = new Calculator(); } @Test public void test1Plus2Equals3() { int result = calculator.plus(1, 2); assertEquals(result, 3) } @After public void tearDown() { calculator = null; } }
ทำไมต้อง Auto Test - นอนหลับสบายขึ้น - มีเวลาอยู่กับครอบครัวมากขึ้น - ท้องไม่อืด
ทำไมต้อง Auto Test - ทำงานได้เร็วกว่าให้คนกด ทำซ้ำได้บ่อย - developer รับผิดชอบงานของตัวเองเต็มที่ -
มีความมั่นใจใน software สูงขึ้นมาก - release software ได้เร็วขึ้น
exercise 1 1. clone project FizzBuzz 2. อ่าน README และทำความเข้าใจ
3. เปิด project ใน Eclipse แล้วสร้าง test case ใหม่ๆ 4. ทดลองรัน Test ใน Eclipse ด้วย JUnit
exercise 1.1 1. refactor FizzBuzz 2. รันเทสให้มั่นใจ ว่ามันยังทำงานได้ตามต้องการ 3. พยายามทำตาม
The Transformation Priority Premise
exercise 2 1. clone project chidchat 2. ลองรัน Server และ
Client เล่น 3. ลองนำ Client ไปต่อกับ server • host: 128.199.193.120 • port: 5000
exercise 2.1 1. ให้เลือก emoticon 1 ตัวจาก • https://www.emojicopy.com/ 2.
สร้าง issue emoticon <emo-name> 3. ทำให้ server สามารถรับ keyword แล้วแสดงเป็น emoticon ได้ • เช่น :sob: แสดงเป็น เขียน Test ด้วย!!