Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Introduction Anish Shah Team Lead @ MULTIDOTS WP Explorer & Agile Enthusiastic PSM-I Certified

Slide 3

Slide 3 text

Developers + QA ● QA = Quality Assurance ● How many Beginners dev? How many QA?

Slide 4

Slide 4 text

What you’ll learn

Slide 5

Slide 5 text

Understand Quality ● What is Quality? ● Quality = Conformance to requirements ● Mindset: Quality is everyone’s responsibility

Slide 6

Slide 6 text

Code Level Improvements ● Following WP standards ○ https://github.com/WordPress/WordPress-Coding-Standards ● Avoid - No maintenance ○ https://developer.wordpress.org/plugins/wordpress-org/take-over-an-existing-plugin ● Malleable code (extensible?) ● Stick to the DRY & KISS principle. ○ Avoid duplicated code using code in template part files. ● Keep functionality out of your themes – use a plugin instead. ● Secure your code ○ https://wordpress.org/support/article/hardening-wordpress

Slide 7

Slide 7 text

Types of testing ● Unit testing ○ the first step to guarantee your code works. ○ a function, usually—works as intended? ○ A unit test will simply check that, given a certain input, we get the expected output. ● Integration testing ○ Different pieces of our plugin come together, they serve a greater purpose and solve a bigger problem. ○ To make sure that all the different components work properly altogether ● Acceptance Tests ○ Write tests that simulate the interaction of a user with their browser.

Slide 8

Slide 8 text

TDD ● Workflow # previous ○ you write some code, ○ you create the tests that verify it, ○ you execute the tests and make sure that everything works as expected. ● Workflow # TDD ○ first, you write the test for a new functionality, ○ you verify the test fails (and it will fail, because you haven’t write any code for that new functionality), ○ you write some new code to solve the problem at hand, ○ you execute the test and make sure that, after your new code is over, it passes.

Slide 9

Slide 9 text

TDD Example google_site_verification($google_code); } public function google_site_verification($code) { return ""; } } new WP_Meta_Verify();

Slide 10

Slide 10 text

TDD Example cont... public function test_google_site_verification() { $meta_tag = $this->class_instance->google_site_verification('B6wFaCRbzWE42SyxSvKU OyyPxZfJCb5g'); $expected = ''; $this->assertEquals($expected, $meta_tag); } // https://github.com/anish274/wp-meta-verify

Slide 11

Slide 11 text

TDD Benefits ● Modular design ○ Cleaner & clearer code ○ It is isolated and easily traceable ○ Faster development and faster changes ● Detects my webapp is affected by the latest change or not ● Tests become the documentations

Slide 12

Slide 12 text

Conclusion ● Quality is not an act it is an habit.

Slide 13

Slide 13 text

Questions ?

Slide 14

Slide 14 text

Thank You