Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
How Go test tests
Seiji Takahashi
December 11, 2017
Programming
2
3.7k
How Go test tests
Presentation for golang.tokyo #11
Seiji Takahashi
December 11, 2017
Tweet
Share
More Decks by Seiji Takahashi
See All by Seiji Takahashi
Go Backends for frontends with GraphQL and gRPC
timakin
5
2.7k
Design Pattern for Image and Text Composition in Go
timakin
5
5.1k
Golang API Testing the HARD way
timakin
13
5k
Head First Golang Image Package
timakin
2
8.1k
React Native Beyond Prototype
timakin
2
1.3k
Performance Optimization on Google AppEngine
timakin
5
5k
testcache.pdf
timakin
1
55
How Go cache
timakin
1
39
How Go cache tests
timakin
1
2k
Other Decks in Programming
See All in Programming
全国の中高生がプログラミングを学んでいるCloud9環境の仕組み@JAWS-UG_SRE支部_#3
asache3
0
120
WindowsコンテナDojo : 第1回 Visual StudioでWindowsコンテナアプリ作成
oniak3ibm
PRO
0
330
Monadic Java
mariofusco
4
260
2022 FrontEnd Training
mixi_engineers
1
280
dbtとBigQueryで始めるData Vault入門
kazk1018
0
190
Milestoner
bkuhlmann
1
200
GraphQL+KMM開発でわかったこと / What we learned from GraphQL+KMM development
kubode
0
130
Modern Web Apps with Spring Boot, Angular & TypeScript
toedter
12
14k
Micro Frontends with Module Federation: Beyond the Basics @jax2022
manfredsteyer
PRO
1
290
コードの解析と言語習得の心得
jinjin33333
0
130
Composing an API with Kotlin (Kotlin Dev Day 2022)
zsmb
0
270
코드 품질 1% 올리기
pluu
1
990
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
212
20k
A Philosophy of Restraint
colly
192
14k
Typedesign – Prime Four
hannesfritz
33
1.3k
Fantastic passwords and where to find them - at NoRuKo
philnash
25
1.5k
Imperfection Machines: The Place of Print at Facebook
scottboms
253
11k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
349
27k
What the flash - Photography Introduction
edds
61
10k
The Most Common Mistakes in Cover Letters
jrick
PRO
4
24k
Designing for humans not robots
tammielis
241
23k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
268
11k
Faster Mobile Websites
deanohume
294
28k
Build your cross-platform service in a week with App Engine
jlugia
219
17k
Transcript
How Go test tests @__timakin__
• Seiji Takahashi • Github: timakin / Twitter: @__timakin__ •
גࣜձࣾGunosy ৽نࣄۀ։ൃࣨ • Go / Swift ࣗݾհ
Copyright© Gunosy Inc. All Rights Reserved 3 Go / Python
ΤϯδχΞืूத ▶https://gunosy.co.jp/recruit/ Gunosyɺ౦ژେֶʹ௨͏3ਓͷֶੜͷ ʮใΛੈքதͷਓʹ࠷దʹಧ͚͍ͨʯͱ͍͏͍͔Β࢝·Γ·ͨ͠ɻ ౦ূϚβʔζ্ɺຊώϧζͷΦϑΟεҠసΛܦͯɺ େ͖͍ͯ͘͠ΔձࣾͰ׆༂͍ͨ͠ϝϯόʔΛืू͍ͯ͠·͢ɻ
Test of test
None
Go1.9~ ͕ؔͲΜͳग़ྗΛ͢Δͷ͔ɺ ExampleΛఆٛͰ͖ΔΑ͏ʹ
None
None
TestίϚϯυʹؔΘΔ࣮ • src/testing • ςετ࣮ߦ࣌ʹ͏T, BͳͲͷ࣮ • testing.commonͱ͍͏ߏମ͕ϝΠϯϩδοΫΛ͍࣋ͬͯΔ • ίϚϯυͷflagύʔε
• benchmarking, ΧόϨοδଌఆͳͲ • Fail, SkipͳͲͷ࣮
common
None
গͳ͍ʂ؆୯ʂ
Mergeͯ͠΄͍͠ʂ
Can you add tests?
ςετͷ࣮ߦ݁Ռͬͯ Ͳ͏ͬͯ ςετ͢ΔΜͩʁ
ςετͬͯͲ͏ͬͯ ςετ͢ΔΜͩʁ
For testing tests • src/cmd/go/go_test.go • Go commandsͷςετ࣮ߦ
For testing tests • src/cmd/go/go_test.go • Go commandsͷςετ࣮ߦ
For testing tests • testgoData • ͍͍ײ͡ʹfixtureΛಡΈࠐΜͩΓɺ ࣮ߦޙͷCleanupΛͯ͘͠ΕΔ
For testing tests • src/cmd/go/testdata/src/* • ςετ༻ͷFixtureΛఆٛ
all.bashΛճͤ ສࣄOK
Let’s Contribute!
ʕ ◔ϖ◔ʔ < Thank You!!