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
49
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
24
Docker Compose for Rails Developer
offfffz
1
37
Day 2 - Docker
offfffz
0
45
Day 2 - CI
offfffz
0
57
Day 1 - Git
offfffz
0
90
Other Decks in Programming
See All in Programming
Google Opalで使える37のライブラリ
mickey_kubo
3
170
実践Claude Code:20の失敗から学ぶAIペアプログラミング
takedatakashi
18
9.2k
Go言語はstack overflowの夢を見るか?
logica0419
0
660
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
620
SODA - FACT BOOK(JP)
sodainc
1
9k
バッチ処理を「状態の記録」から「事実の記録」へ
panda728
PRO
0
210
CSC305 Lecture 12
javiergs
PRO
0
240
Vueのバリデーション、結局どれを選べばいい? ― 自作バリデーションの限界と、脱却までの道のり ― / Which Vue Validation Library Should We Really Use? The Limits of Self-Made Validation and How I Finally Moved On
neginasu
3
1.7k
開発組織の戦略的な役割と 設計スキル向上の効果
masuda220
PRO
10
1.9k
TransformerからMCPまで(現代AIを理解するための羅針盤)
mickey_kubo
7
5.8k
Researchlyの開発で参考にしたデザイン
adsholoko
0
100
スキーマ駆動で、Zod OpenAPI Honoによる、API開発するために、Hono Takibiというライブラリを作っている
nakita628
0
330
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
2.9k
jQuery: Nuts, Bolts and Bling
dougneiner
65
7.9k
The Language of Interfaces
destraynor
162
25k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Keith and Marios Guide to Fast Websites
keithpitt
411
23k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
Speed Design
sergeychernyshev
32
1.2k
Product Roadmaps are Hard
iamctodd
PRO
55
11k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
Typedesign – Prime Four
hannesfritz
42
2.8k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
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 ด้วย!!