Your SlideShare is downloading. ×
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Test

1,381

Published on

Something about Test, Unit Test, Integration Test and Acceptance Test with powerful testing tools such as PHPUnit and Selenium RC.

Something about Test, Unit Test, Integration Test and Acceptance Test with powerful testing tools such as PHPUnit and Selenium RC.

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,381
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

































































































































  • Transcript

    • 1. TEST
    • 2. TEST presented by eddie 2009.1.15
    • 3. Agenda
    • 4. Agenda • Something about Test
    • 5. Agenda • Something about Test what? why? why not and how to....
    • 6. Agenda • Something about Test what? why? why not and how to.... • Test in action!
    • 7. Agenda • Something about Test what? why? why not and how to.... • Test in action! Test tools introduction, installation and real coding practice.
    • 8. Agenda • Something about Test what? why? why not and how to.... • Test in action! Test tools introduction, installation and real coding practice. Unit test, Integration test and Acceptance test.
    • 9. Agenda • Something about Test what? why? why not and how to.... • Test in action! Test tools introduction, installation and real coding practice. Unit test, Integration test and Acceptance test. • Test in PHP Frameworks
    • 10. Agenda • Something about Test what? why? why not and how to.... • Test in action! Test tools introduction, installation and real coding practice. Unit test, Integration test and Acceptance test. • Test in PHP Frameworks Zend Framework(still working...)
    • 11. Agenda • Something about Test what? why? why not and how to.... • Test in action! Test tools introduction, installation and real coding practice. Unit test, Integration test and Acceptance test. • Test in PHP Frameworks Zend Framework(still working...) CakePHP(still working...)
    • 12. What’s Test?
    • 13. Test != Debug
    • 14. Why Test?
    • 15. Every Programmers Makes Mistakes!!
    • 16. Why Not Test?
    • 17. Why not Test?
    • 18. Why not Test? • No Time!
    • 19. Why not Test? • No Time! • Boring!
    • 20. Why not Test? • No Time! • Boring! • Hey! I’m an experienced programmer!
    • 21. Advantages
    • 22. Advantages • The sooner you test for a mistake, the greater your chance of finding it and the less it will cost to find and fix.
    • 23. Advantages • The sooner you test for a mistake, the greater your chance of finding it and the less it will cost to find and fix. • Good software quality.
    • 24. Advantages • The sooner you test for a mistake, the greater your chance of finding it and the less it will cost to find and fix. • Good software quality. • More confidence in your product(code)!
    • 25. Then.... What’s the problem?
    • 26. Unit Test
    • 27. Unit Test • Verify the individual units of source code are working properly.
    • 28. Unit Test • Verify the individual units of source code are working properly. • A unit is the smallest testable part of an application.
    • 29. Unit Test • Verify the individual units of source code are working properly. • A unit is the smallest testable part of an application. • May belong to a base/super class, abstract class or derived/child class.
    • 30. Integration Test
    • 31. Integration Test • Verify high level components of the application work as expected.
    • 32. Integration Test • Verify high level components of the application work as expected. • Use mocks, stubs and specialised test classes.
    • 33. Acceptance Test
    • 34. Acceptance Test • Aka “Functional Test”
    • 35. Acceptance Test • Aka “Functional Test” • Ensures that an application behaves as expected by the client.
    • 36. Tools
    • 37. Test Tools
    • 38. Test Tools • PHPUnit(Modelled after JUnit)
    • 39. Test Tools • PHPUnit(Modelled after JUnit) • Selenium Remote-Control
    • 40. PHPUnit
    • 41. PHPUnit • Requirements
    • 42. PHPUnit • Requirements • PHP 5.1.4 (or greater) is required, PHP 5.2 is recommended. PHPUnit 4 will require PHP 5.3.
    • 43. PHPUnit • Requirements • PHP 5.1.4 (or greater) is required, PHP 5.2 is recommended. PHPUnit 4 will require PHP 5.3. • more information: http://www.phpunit.de/wiki/Requirements
    • 44. How to Test?
    • 45. How to Test? • Setup
    • 46. How to Test? • Setup • Execute
    • 47. How to Test? • Setup • Execute • Verify
    • 48. How to Test? • Setup • Execute • Verify • Teardown
    • 49. PHPUnit Install
    • 50. PHPUnit Install • Install from PEAR or manual installation.
    • 51. PHPUnit Install • Install from PEAR or manual installation. • Manual installation:
    • 52. PHPUnit Install • Install from PEAR or manual installation. • Manual installation: 1. download source
    • 53. PHPUnit Install • Install from PEAR or manual installation. • Manual installation: 1. download source 2. extract and put library in include_path
    • 54. PHPUnit Install • Install from PEAR or manual installation. • Manual installation: 1. download source 2. extract and put library in include_path 3. minor modifications:
    • 55. PHPUnit Install • Install from PEAR or manual installation. • Manual installation: 1. download source 2. extract and put library in include_path 3. minor modifications: CLI : phpunit
    • 56. PHPUnit Install • Install from PEAR or manual installation. • Manual installation: 1. download source 2. extract and put library in include_path 3. minor modifications: CLI : phpunit utils/fileloader.php
    • 57. Conventions
    • 58. Conventions • Function test*() without arguments ex: testArray(), testmyfunction()
    • 59. Conventions • Function test*() without arguments ex: testArray(), testmyfunction() • Define in docblock: ex: @test
    • 60. Conventions • Function test*() without arguments ex: testArray(), testmyfunction() • Define in docblock: ex: @test • Test functions have to be PUBLIC
    • 61. Remember!!
    • 62. Remember!! Comments(docblock) are MEANINGFUL !
    • 63. Assert Method
    • 64. Assert Method They are methods for automatically checking values and reporting discrepancies.
    • 65. Test Skeleton Generator
    • 66. Test Skeleton Generator • Generate a test class file from classes.
    • 67. Test Skeleton Generator • Generate a test class file from classes. • Usage: phpunit --skeleton-test testname(.php)
    • 68. And....vise versa
    • 69. And....vise versa • Generate a class skeleton from test case classes.
    • 70. And....vise versa • Generate a class skeleton from test case classes. • Usage: phpunit --skeleton-class classname(.php)
    • 71. And....vise versa • Generate a class skeleton from test case classes. • Usage: phpunit --skeleton-class classname(.php) • Test-Driven Developement.
    • 72. Test Case Extensions
    • 73. Test Case Extensions • Tests for Output
    • 74. Test Case Extensions • Tests for Output • Tests for Performance
    • 75. Test Case Extensions • Tests for Output • Tests for Performance • Tests for Database
    • 76. Not finish yet...
    • 77. Not finish yet... • Incompleted Tests
    • 78. Not finish yet... • Incompleted Tests • Skip Tests
    • 79. Unit Test
    • 80. Unit Test
    • 81. Unit Test <?php require_once 'PHPUnit/Framework.php'; require_once 'testcal.php'; class testcalTest extends PHPUnit_Framework_TestCase { protected $object; protected function setUp() { $this->object = new testcal; } public function testAdd() { $this->assertEquals(2, $this->object->add(1, 1)); } }
    • 82. Easy Way...
    • 83. Easy Way... <?php class Calculator { /** * @assert (0,0) == 0 * @assert (0,1) == 1 * @assert (1,0) == 1 * @assert (1,1) == 2 * @assert (1,2) != 3 */ public function add($a, $b) { return $a + $b; } }
    • 84. Compose your Tests
    • 85. Compose your Tests • Test Function(phpunit --filter testFunc)
    • 86. Compose your Tests • Test Function(phpunit --filter testFunc) • Test Case
    • 87. Compose your Tests • Test Function(phpunit --filter testFunc) • Test Case • Test Suite(setUp(), tearDown())
    • 88. Integration Test
    • 89. Test Double
    • 90. Test Double • When some other components cannot be used in the test environment...
    • 91. Test Double • When some other components cannot be used in the test environment... • The Test Double doesn't have to behave exactly like the real components; it merely has to provide the same API as the real one so that just let the test procedure thinks it is the real one!
    • 92. Acceptance Test
    • 93. Selenium RC
    • 94. Selenium RC • Selenium Remote-Control(RC) is a test tool that allows you to write automated user-interface tests for web applications in any programming language against any HTTP website using any mainstream browser.
    • 95. Selenium RC • Selenium Remote-Control(RC) is a test tool that allows you to write automated user-interface tests for web applications in any programming language against any HTTP website using any mainstream browser. • More infomation: http://seleniumhq.org
    • 96. How it works?
    • 97. How it works?
    • 98. More details....
    • 99. More details....
    • 100. Code Coverage
    • 101. Code Coverage • phpunit --coverage-html <reportDIR> testClass(.php)
    • 102. Code Coverage • phpunit --coverage-html <reportDIR> testClass(.php) • xdebug is required
    • 103. Test-Driven Development
    • 104. Test-Driven Development • Test before coding.
    • 105. Test-Driven Development • Test before coding. • Well-designed architecture and APIs.
    • 106. Test for PHP Frameworks
    • 107. Test for Zend Framework
    • 108. Test for Zend Framework • Application Login TestCase Example. • Test Case: The login page should contain one login form and be displayed to non-authenticated users. When a user logs in, they should be redirected to their profile page, and that profile page should show relevant information.
    • 109. Test for CakePHP
    • 110. Test for CakePHP • To be Continued...
    • 111. References
    • 112. References • Manual: • PHPUnit Manual V3.3 • Articles: • PHPUnit: • An Introduction to the Art of Unit Testing in PHP • Check your PHP code at every level with unit tests • Acceptance Testing of Web Applications with PHP • Zend Framework: • Zend_Test_PHPUnit
    • 113. Debugging Sucks, Testing Rocks!
    • 114. Thank you :)

    ×