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
Flutterで備える!Accessibility Nutrition Labels完全ガイド
yuukiw00w
0
170
RailsGirls IZUMO スポンサーLT
16bitidol
0
200
フロントエンドのパフォーマンスチューニング
koukimiura
5
2k
Vibe Codingの幻想を超えて-生成AIを現場で使えるようにするまでの泥臭い話.ai
fumiyakume
9
3.8k
PicoRuby on Rails
makicamel
2
140
効率的な開発手段として VRTを活用する
ishkawa
0
160
ペアプロ × 生成AI 現場での実践と課題について / generative-ai-in-pair-programming
codmoninc
2
21k
Modern Angular with Signals and Signal Store:New Rules for Your Architecture @enterJS Advanced Angular Day 2025
manfredsteyer
PRO
0
270
MDN Web Docs に日本語翻訳でコントリビュートしたくなる
ohmori_yusuke
1
130
「App Intent」よくわからんけどすごい!
rinngo0302
1
100
オンコール⼊⾨〜ページャーが鳴る前に、あなたが備えられること〜 / Before The Pager Rings
yktakaha4
2
990
AI駆動のマルチエージェントによる業務フロー自動化の設計と実践
h_okkah
0
230
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.7k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Visualization
eitanlees
146
16k
Balancing Empowerment & Direction
lara
1
450
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
282
13k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
48
2.9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
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 ด้วย!!