Post on 17-May-2015
description
Wordcamp san francisco, aug 13, 2011
HOW TESTING CHANGED MY LIFE
Nikolay bachiyski, automattic
Next30 minutes
0. what?
1. example plugin
2. do it yourself!
what?
Automated
http://www.flickr.com/photos/binaryape/4882162452/
0. what?
xUnit
0. what?
PHPUnithttp://www.phpunit.de/manual/current/en/
0. what?
class WP_Is_Email_Test extends WP_UnitTestCase {
}
function test_is_email_only_letters_with_dot_com_domain() { $this-‐>assertEquals( 'nb@nikolay.com', is_email( 'nb@nikolay.com' ) ); } function test_is_email_should_not_allow_missing_tld() { $this-‐>assertFalse( is_email( 'nb@nikolay' ) ); } function test_is_email_should_allow_bg_domain() { $this-‐>assertEquals( 'nb@nikolay.bg', is_email( 'nb@nikolay.bg' ) ); }
0. what?
class WP_Is_Email_Test extends WP_UnitTestCase {
}
function test_is_email_should_not_allow_missing_tld() { $this-‐>assertFalse( is_email( 'nb@nikolay' ) ); } function test_is_email_should_allow_bg_domain() { $this-‐>assertEquals( 'nb@nikolay.bg', is_email( 'nb@nikolay.bg' ) ); }
function test_is_email_only_letters_with_dot_com_domain() { $this-‐>assertEquals( 'nb@nikolay.com', is_email( 'nb@nikolay.com' ) ); }
0. what?
0. what?
Example Plugin
WP_Bearify
do it yourself!
2. do it yourself!
Grab the Framework
https://github.com/nb/wordpress-tests
soon in core2. do it yourself!
Please, readhttp://xunitpatterns.com/
http://xunitpatterns.com/Book%20Outline.html
at least Narratives:
2. do it yourself!
PHPUnit
http://www.phpunit.de/manual/current/en/
2. do it yourself!
PHPUnit in your editor
https://github.com/meritt/phpunit-tmbundle/https://github.com/klokane/vim-phpunit
2. do it yourself!
FEAR!
FEAR!
http://www.flickr.com/photos/eebrierley/5394195199/
warm & cozy > FEARwarm & cozy > FEAR