A New Testing Framework Rgot

77897395d9b84463bd474a69b922b2ec?s=47 ksss
December 12, 2015

A New Testing Framework Rgot

Speech of RubyKaigi2015 LT

77897395d9b84463bd474a69b922b2ec?s=128

ksss

December 12, 2015
Tweet

Transcript

  1. 3.
  2. 13.

    Rgot ksss/rgot ! module FooTest def test_foo(t) if 3 !=

    (1 + 2) t.error("failed") end end end
  3. 15.

    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
  4. 16.

    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
  5. 18.

    Rgot ksss/rgot ! module FooTest def benchmark_qux(b) i = 0

    while i < b.n Foo.qux i += 1 end end end
  6. 19.

    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) } }) }
  7. 20.
  8. 21.

    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
  9. 22.

    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
  10. 25.

    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
  11. 26.

    Rgot ksss/rgot ! $ rgot -v === RUN example_foo ---

    FAIL: example_foo (0.00s) got: bar want: foo FAIL exit status 1 FAILRgotTest 0.001s
  12. 41.

    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 !
  13. 43.

    Words - assert - should - expect - must minitest,

    test-unit, rspec, … ksss/rgot !
  14. 44.

    Words - want - got - failed - invalid Golang

    testing package ksss/rgot !