Slide 1

Slide 1 text

How to contribute to OSS with test How to contribute to OSS with test

Slide 2

Slide 2 text

Kazushige Tominaga Kazushige Tominaga tooooooooomy Github : Twitter : creator of A testing library for PHP legacy products https://github.com/kazu9su https://twitter.com/tooooooooomy https://github.com/kazu9su/functional-tester

Slide 3

Slide 3 text

Today I don't talk about... Today I don't talk about... Principle of TDD How important test is! Something like that

Slide 4

Slide 4 text

Today I talk about... Today I talk about... Why do I write test? Process of contributing Points of writing test of OSS

Slide 5

Slide 5 text

I write test just because I like test :) I write test just because I like test :)

Slide 6

Slide 6 text

OK OK

Slide 7

Slide 7 text

An example Open Source So ware An example Open Source So ware is... is...

Slide 8

Slide 8 text

mastodon mastodon

Slide 9

Slide 9 text

One day, I found a spec file... One day, I found a spec file...

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Great Great

Slide 12

Slide 12 text

But wait, But wait,

Slide 13

Slide 13 text

There are a lot of rules in testing world There are a lot of rules in testing world TDD should test all of methods BDD should test behavior Test only provided public methods included in BDD?

Slide 14

Slide 14 text

What is the policy of mastodon? What is the policy of mastodon?

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Let's send a Pull Request! Let's send a Pull Request!

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

What is the point? What is the point? Write test just about 1 method Committers can see PR easily Write private methods's test I can find out their testing style explicitly

Slide 19

Slide 19 text

Let's see their reactions... Let's see their reactions...

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Looks like my PR perfect Looks like my PR perfect

Slide 22

Slide 22 text

OK, so let's go ahead! OK, so let's go ahead!

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

There is no immediate harm in these tests but you should know that unit tests should not try to look into private methods or internal variables. The unit test must confirm the public API of the class works, i.e. how other code will use it. The internal implementation of the class is subject to change (refactoring). The perfect refactoring is when you change the code but don't have to touch the tests. With tests like these, they would also have to be modified if the internal implementation changes in the future.

Slide 27

Slide 27 text

Finally, I could get usable Finally, I could get usable information from the author. information from the author. PR has already been merged, but don't mind :)

Slide 28

Slide 28 text

I completely understand about it I completely understand about it

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

Looks Good To Me :) Looks Good To Me :)

Slide 32

Slide 32 text

Sample PRs Sample PRs https://github.com/tootsuite/mastodon/pull/6439 https://github.com/tootsuite/mastodon/pull/6446 https://github.com/tootsuite/mastodon/pull/6455 https://github.com/tootsuite/mastodon/pull/6456 https://github.com/tootsuite/mastodon/pull/6500

Slide 33

Slide 33 text

Conclusion Conclusion Well-known OSS needs test Communication with committers is the most important Make simple, understandable PR Enjoy testing

Slide 34

Slide 34 text

Please introduce me the OSS needs test :) Please introduce me the OSS needs test :)

Slide 35

Slide 35 text

Thank you! Thank you!