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
A New Testing Framework Rgot
Search
ksss
December 12, 2015
Programming
1.3k
0
Share
A New Testing Framework Rgot
Speech of RubyKaigi2015 LT
ksss
December 12, 2015
More Decks by ksss
See All by ksss
RaaP
ksss
0
740
Railsの型ファイル自動生成における課題と解決
ksss
4
5.3k
RBS generation framework using Rack architecture
ksss
1
7.7k
mrubyでruby/specを走らせてみた結果www
ksss
1
2.5k
Rubyに型があると便利か
ksss
4
4.7k
mruby hacking guide
ksss
7
2k
Other Decks in Programming
See All in Programming
OTP を自動で入力する裏技
megabitsenmzq
0
130
Feature Toggle は捨てやすく使おう
gennei
0
390
Codex の「自走力」を高める
yorifuji
0
1.3k
PHP 7.4でもOpenTelemetryゼロコード計装がしたい! / PHPerKaigi 2026
arthur1
1
450
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
580
Linux Kernelの1文字のミスで 権限昇格ができた話
rqda
0
2.2k
夢の無限スパゲッティ製造機 -実装篇- #phpstudy
o0h
PRO
0
180
PHP でエミュレータを自作して Ubuntu を動かそう
m3m0r7
PRO
2
150
「効かない!」依存性注入(DI)を活用したAPI Platformのエラーハンドリング奮闘記
mkmk884
0
280
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.6k
The free-lunch guide to idea circularity
hollycummins
0
390
Java 21/25 Virtual Threads 소개
debop
0
310
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
New Earth Scene 8
popppiees
2
1.9k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
79
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
370
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
120
Balancing Empowerment & Direction
lara
5
1k
Practical Orchestrator
shlominoach
191
11k
Un-Boring Meetings
codingconduct
0
240
Building an army of robots
kneath
306
46k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
SEO for Brand Visibility & Recognition
aleyda
0
4.4k
Transcript
A New Testing Framework Rgot ksss RubyKaigi2015
! " ksss _ksss_
None
A New Testing Framework was born …
Rgot Ruby + Golang Testing ksss/rgot !
$ gem i rgot ksss/rgot ! ruby 2.0 ʙ
!? ksss/rgot !
Again? ksss/rgot !
Do We Have to Learning New Things? ksss/rgot !
Rgot is Translation from Golang Testing to Ruby ksss/rgot !
Incidentally You Can Learn Golang Testing! ksss/rgot !
Golang ksss/rgot ! package foo_test func TestFooBar(t *testing.T) { if
3 != (1 + 2) { t.Error("failed") } }
Rgot ksss/rgot ! module FooTest def test_foo(t) if 3 !=
(1 + 2) t.error("failed") end end end
Golang-ish ksss/rgot !
Golang ksss/rgot ! $ go test -v === RUN TestFoo
--- PASS: TestFoo (1.01s) === RUN TestBar --- PASS: TestBar (1.00s) === RUN TestBaz --- PASS: TestBaz (1.01s) PASS ok ksss/gotest 3.017s
Rgot ksss/rgot ! $ rgot -v === RUN test_foo ---
PASS: test_foo (1.01s) === RUN test_bar --- PASS: test_bar (1.00s) === RUN test_baz --- PASS: test_baz (1.01s) PASS ok RgotTest 3.042s
Golang ksss/rgot ! package foo_test func BenchmarkQux(b *testing.B) { for
i := 0; i < b.N; i++ { foo.Qux() } }
Rgot ksss/rgot ! module FooTest def benchmark_qux(b) i = 0
while i < b.n Foo.qux i += 1 end end end
Golang ksss/rgot ! package pow_test func BenchmarkPow(b *testing.B) { b.RunParallel(func(pb
*testing.PB) { for pb.Next() { math.Pow(1000.0, 1000.0) } }) }
Rgot ksss/rgot ! module PowTest def benchmark_pow(b) b.run_parallel do |pb|
while pb.next 1000.0 ** 1000.0 end end end end
Golang ksss/rgot ! $ go test -bench . -cpu 2,4
PASS BenchmarkPow-2 100000000 22.3 ns/op BenchmarkPow-4 100000000 12.5 ns/op ok github.com/pow_test 3.522s GOMAXPROCS
Rgot ksss/rgot ! $ rgot --bench . --cpu 2,4 --thread
2,4 PASS benchmark_pow-2(2) 25600000 74 ns/op benchmark_pow-2(4) 81920000 74 ns/op benchmark_pow-4(2) 81920000 39 ns/op benchmark_pow-4(4) 40960000 40 ns/op ok PowTest 13.603s process thread
Golang ksss/rgot ! package foo_test func ExampleFoo { fmt.Println(foo.Say()) //
Output: // foo }
Rgot ksss/rgot ! module FooTest def example_foo puts Foo.say #
Output: # foo end end
Golang ksss/rgot ! $ go test -v === RUN ExampleFoo
--- FAIL: ExampleFoo (0.00s) got: bar want: foo FAIL exit status 1 FAILgithub.com/ksss/gotest 0.005s
Rgot ksss/rgot ! $ rgot -v === RUN example_foo ---
FAIL: example_foo (0.00s) got: bar want: foo FAIL exit status 1 FAILRgotTest 0.001s
Thinking ksss/rgot !
Diversity ksss/rgot !
Testing before Benchmark ksss/rgot !
Testable Sample Code ksss/rgot !
Not Need /test or /spec Dir ksss/rgot !
ksss/rgot !
Short Class Name testing.M => Rgot::M testing.T => Rgot::T testing.B
=> Rgot::B ksss/rgot !
Zero Assert ksss/rgot !
t.error() ksss/rgot !
More Thinking ksss/rgot !
Assert Oriented v.s. Error log Oriented ksss/rgot !
Assert Oriented case ksss/rgot ! mimitest, test-unit, rspec, etc…
case ksss/rgot ! Error log Oriented
Error Report is Important ksss/rgot !
Precise errors are particularly important when the programmer seeing the
errors is not familiar with the code. #https://golang.org/doc/faq#assertions ksss/rgot !
Words ksss/rgot !
Words - assert - should - expect - must minitest,
test-unit, rspec, … ksss/rgot !
Words - want - got - failed - invalid Golang
testing package ksss/rgot !
Words (hypothesis) minitest, test_unit, rspec,… Golang testing package Hard Soft
ksss/rgot !
ksss/rgot !