Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to contribute to OSS with test

How to contribute to OSS with test

Kazushige Tominaga

February 21, 2018
Tweet

More Decks by Kazushige Tominaga

Other Decks in Programming

Transcript

  1. How to contribute to OSS with test How to contribute

    to OSS with test
  2. 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
  3. Today I don't talk about... Today I don't talk about...

    Principle of TDD How important test is! Something like that
  4. Today I talk about... Today I talk about... Why do

    I write test? Process of contributing Points of writing test of OSS
  5. I write test just because I like test :) I

    write test just because I like test :)
  6. OK OK

  7. An example Open Source So ware An example Open Source

    So ware is... is...
  8. mastodon mastodon

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

    found a spec file...
  10. None
  11. Great Great

  12. But wait, But wait,

  13. 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?
  14. What is the policy of mastodon? What is the policy

    of mastodon?
  15. None
  16. Let's send a Pull Request! Let's send a Pull Request!

  17. None
  18. 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
  19. Let's see their reactions... Let's see their reactions...

  20. None
  21. Looks like my PR perfect Looks like my PR perfect

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

  23. None
  24. None
  25. None
  26. 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.
  27. 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 :)
  28. I completely understand about it I completely understand about it

  29. None
  30. None
  31. Looks Good To Me :) Looks Good To Me :)

  32. 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

  33. Conclusion Conclusion Well-known OSS needs test Communication with committers is

    the most important Make simple, understandable PR Enjoy testing
  34. Please introduce me the OSS needs test :) Please introduce

    me the OSS needs test :)
  35. Thank you! Thank you!