- 1. Changes
- 2. Testing in Perl
- 3. Preface
- 3.1. Why Test?
- 3.2. What are automated test?
- 3.3. Manual testing
- 3.4. Why Automate?
- 3.5. Functional Testing
- 3.6. Unit/Integration/Acceptance Test
- 3.7. White box and Black box testing
- 3.8. Objectives of the course
- 3.9. Plan of the seminar
- 3.10. Process of testing
- 4. Basic Testing Framework in Perl
- 4.1. Things we are going to test
- 4.2. Testing a simple Perl module
- 4.3. Calculator test
- 4.4. Test with expected results
- 4.5. More test cases, more output
- 4.6. Complex output
- 4.7. ok, not ok
- 4.8. Print only ok/not ok
- 4.9. Refactor - Write the ok function
- 4.10. Introducing Test::Simple
- 4.11. Test::Simple when everything is ok
- 4.12. Test::Simple - missing test
- 4.13. Test::Simple - too many tests
- 4.14. Add names to the tests
- 4.15. Exercise: Write tests for fibo
- 4.16. Exercise: Write a test to test the Anagram checker
- 4.17. Exercise: Enlarge the test
- 4.18. Solution: Write tests for fibo
- 4.19. Solution: Write a test to test the Anagram checker
- 4.20. Solution: Enlarge our test suite
- 4.21. Refactor larger test suite
- 4.22. Forget about your "plan", use "no_plan"
- 4.23. use BEGIN block with Test::Simple
- 4.24. Put the test cases in an external file
- 4.25. Large test suite
- 4.26. Harness
- 4.27. Harness on success
- 4.28. Harness on too few tests
- 4.29. prove
- 4.30. Packaging as people do for CPAN
- 4.31. Makefile.PL for ExtUtils::MakeMaker
- 4.32. Makefile.PL for Module::Install
- 4.33. Build.PL
- 4.34. Directories under t and prove
- 4.35. Simple CPAN-like module
- 4.36. Commands for CPAN release
- 4.37. Exercise: Add tests
- 4.38. Test::Simple
- 5. Test::More
- 5.1. Moving over to Test::More
- 5.2. Test::Simple ok( trueness, name);
- 5.3. Test::More ok( trueness, name);
- 5.4. Test::More is( value, expected_value, name);
- 5.5. Test::More isnt( value, not_expected_value, name);
- 5.6. Test::More isnt undef
- 5.7. note( message ) or diag( message );
- 5.8. (note or diag) explain( a_variable );
- 5.9. TODO
- 5.10. TODO Verbose output
- 5.11. TODO: unexpected success
- 5.12. TODO: unexpected success (the code)
- 5.13. MyTools with various functions
- 5.14. like(value, qr/expected regex/, name);
- 5.15. like(value, qr/expected regex/, name);
- 5.16. Another example with like
- 5.17. cmp_ok( this, op, that, name);
- 5.18. is_deeply( complex_structure, expected_complex_structure, name);
- 5.19. Function returning data from bug-tracker
- 5.20. is_deeply on a hash
- 5.21. Platform dependent tests
- 5.22. SKIP some tests
- 5.23. locale
- 5.24. Stop running current test script
- 5.25. Stop all the test scripts
- 5.26. Exercises
- 5.27. Test coverage using Devel::Cover
- 5.28. Test coverage report example
- 5.29. Declare your plan at execution time
- 5.30. done_testing
- 5.31. plan tests, no_testing, done_testing
- 5.32. Compute test plan
- 5.33. subtest with plan
- 5.34. subtest with implicit done_testing
- 5.35. subtest to restrict scope
- 5.36. skip all
- 5.37. Exercise: skip test
- 5.38. Exercise: use coverage
- 5.39. Test blocks (use subtest instead)
- 5.40. Counting tests in the small blocks (use subtest instead)
- 6. Test libraries
- 6.1. Multiple expected values
- 6.2. Multiple expected values revised
- 6.3. Adding information with diag
- 6.4. My own test functions
- 6.5. My own test functions with Test Builder level
- 6.6. Create a test module
- 6.7. Test::Builder
- 6.8. Test::Builder object is a singleton
- 6.9. Skip on the fly
- 6.10. Skip on the fly based on earlier tests
- 6.11. Code emitting warnings
- 6.12. Test::NoWarnings
- 6.13. Test::FailWarnings
- 6.14. Test with warnings
- 6.15. Testing for warnings
- 6.16. Testing for warnings - different warning
- 6.17. Testing for warnings - missing warning
- 6.18. Test::Warn
- 6.19. Test for no warnings - the hard way
- 6.20. No other warnings using Test::NoWarnings
- 6.21. No other warnings Test::FailWarnings
- 6.22. unexpected warnings Test::NoWarnings, Test::FailWarnings
- 6.23. Test::Exception
- 6.24. Exercise: improve test module
- 6.25. Exercise: add is_max
- 6.26. Exercise: is_between
- 6.27. Exercise: test sum
- 6.28. Exercise: Test::Exception
- 6.29. Solution: is_between
- 6.30. Solution: test sum
- 6.31. Perl Best Practices - Perl::Critic
- 6.32. Verify code layout
- 6.33. Why number the test files?
- 6.34. Test::Differences
- 6.35. Test::Deep
- 6.36. Test::File
- 6.37. Test::LongString
- 6.38. Test::Most
- 6.39. Test::Trap
- 6.40. Test::Fatal
- 6.41. Test::XPath
- 6.42. Sample script for testing Client-Server
- 6.43. Sample script for testing Client-Server Win32
- 6.44. Exercise for Test::Builder
- 6.45. Exercise: Math::RPN
- 6.46. Exercise: exceptions
- 6.47. Solution
- 6.48. Devel::Cover script
- 6.49. Can module be loaded? use_ok and require_ok
- 6.50. can_ok('Class', qw(method_a method_b));
- 6.51. All the tests
- 6.52. Smolder
- 6.53. Exercise: Smolder
- 7. Mocking
- 7.1. What is Mocking?
- 7.2. Test Doubles
- 7.3. Test Doubles explained
- 7.4. What is Monkey Patching?
- 7.5. When is mocking useful?
- 7.6. Mocking in various situations
- 7.7. Application using random
- 7.8. Mock random generator in BEGIN
- 7.9. Mock random generator Mock::Sub
- 7.10. Function that (also) writes to STDOUT or STDERR
- 7.11. Capture STDOUT and STDERR in functions call
- 7.12. Code with STDIN
- 7.13. Mock STDIN
- 7.14. Simple game to test
- 7.15. Test simple game (small)
- 7.16. Test simple game (big)
- 7.17. Test simple game (exact)
- 7.18. Exercise: test game
- 7.19. Testing time-dependent module
- 7.20. Module with operation based on date
- 7.21. Mocking fixed absolute time
- 7.22. Module with session timeout
- 7.23. Mocking relative Time
- 7.24. Mocking class
- 7.25. Application using the class
- 7.26. Testing the 3rd party class
- 7.27. Testing our app using the 3rd party class
- 7.28. Testing our app mocking the 3rd party class
- 7.29. Mocking function of external web call
- 7.30. Test the application end-to-end
- 7.31. Mocked web test
- 7.32. Mocking to reproduce error in our function
- 7.33. Mocking exception
- 7.34. Using MetaCPAN::Client
- 7.35. Mocking MetaCPAN::Client
- 7.36. Override printing functions (mocking)
- 7.37. Monkey Patching
- 7.38. Test STDIN
- 7.39. Mocking get in LWP::Simple
- 8. Test::Class
- 8.1. Simple module to test
- 8.2. Test::Class simple example
- 8.3. Test::Class with fixtures
- 8.4. Test::Class run both test classes
- 8.5. Test::Class inline
- 8.6. Test::Class Load
- 9. Running and reporting tests
- 9.1. TAP - Test Anything Protocol
- 9.2. prove
- 9.3. Parallel testing
- 9.4. prove --state
- 9.5. Parse TAP from a file
- 9.6. prove - run other executables
- 9.7. TAP::Formatter::HTML by Steve Purkis
- 9.8. Collecting Test reports
- 9.9. Generating HTML reports from Archives
- 10. BDD - Behavior Driven Development
- 10.1. BDD Hello World
- 10.2. BDD Demo
- 11. Test Command line application
- 11.1. bc - An arbitrary precision calculator language
- 11.2. Normal operation
- 11.3. Expect.pm
- 11.4. Simple computation - adding two values
- 11.5. Results
- 11.6. Reduce output - turn it into a test script
- 11.7. Output
- 11.8. Expect and BAIL_OUT
- 11.9. More than one test
- 11.10. Output
- 11.11. External test file
- 11.12. Random regression tests
- 11.13. Random and regression testing
- 11.14. Random and regression testing - slight improvement
- 11.15. Results
- 11.16. Expect multiple values
- 11.17. Test::Expect
- 11.18. Capturing both STDOUT and STDERR
- 11.19. Capturing both STDOUT and STDERR manually
- 11.20. Capturing both STDOUT and STDERR using IPC::Run3
- 11.21. Capture::Tiny
- 11.22. Test::Snapshots
- 11.23. Exercise: Expect
- 12. Networking devices
- 12.1. Introduction - pick the right abstraction level
- 12.2. Socket level programming using Socket.pm
- 12.3. Newline
- 12.4. Socket level programming using IO::Socket
- 12.5. Net::Telnet
- 12.6. Net::Telnet for HTTP
- 12.7. Net::Telnet configure VLAN
- 12.8. ftp using Net::FTP
- 12.9. ssh using Net::SSH
- 12.10. LWP::Simple
- 12.11. LWP::UserAgent
- 12.12. WWW::Mechanize
- 12.13. WWW::Mechanize for Google
- 12.14. Exercise: Search on Financial Times
- 12.15. Exercise: Compare exchange rates
- 12.16. Exercise: Telnet or SSH to Unix machines
- 12.17. Introduction
- 12.18. Connect to the device
- 12.19. Reduce timeout
- 12.20. Our test script
- 13. Testing Web Applications
- 13.1. What can be tested ?
- 13.2. Extreme web site testing
- 13.3. Tools
- 13.4. Small test HTTP server
- 13.5. Fetching a static page
- 13.6. Fetching a not-existing static page
- 13.7. Checking good HTML
- 13.8. Checking bad HTML
- 13.9. What is this bad HTML ?
- 13.10. HTML::Tidy and Test::HTML::Tidy
- 13.11. Test using W3C validator
- 13.12. Use a local copy of the W3C validator
- 13.13. LWP::Simple and LWP
- 13.14. WWW::Mechanize
- 13.15. Web based Calculator with WWW::Mechanize
- 13.16. Testing with WWW::Mechanize
- 13.17. Test::WWW::Mechanize
- 13.18. Login to Act using Mechanize
- 13.19. More things to test
- 13.20. Test without server Test::WWW::Mechanize::PSGI
- 13.21. Test page with JavaScript
- 14. Selenium
- 14.1. Selenium documentation
- 14.2. Selenium IDE
- 14.3. Launch Selenium server
- 14.4. Selenium DuckDuckGo
- 14.5. Selenium using Chrome
- 14.6. Selenium DuckDuckGo Search
- 14.7. Selenium DuckDuckGo Test
- 14.8. Selenium locator
- 14.9. Selenium locator example
- 14.10. Selenium content
- 14.11. Selenium in the calc example
- 14.12. Selenium examples with JavaScript
- 14.13. Selenium examples with Ajax
- 14.14. WWW::Mechanize::PhantomJS
- 14.15. Testing Dancer
- 14.16. Exercies: MetaCPAN
- 14.17. Exercise: blogs.perl.org
- 14.18. Exercise: Testing Smolder
- 14.19. Exercise: Act
- 15. Servers
- 15.1. Net::Server
- 15.2. Skeleton Server
- 15.3. Simple Echo Server
- 15.4. Echo Server
- 15.5. Complex network servers
- 16. Testing networking devices
- 16.1. Elements
- 16.2. Network testing
- 16.3. Hardware setup
- 16.4. Access the administrative interface
- 16.5. CLI testing
- 16.6. Configure devices on all sides of our box
- 16.7. Run tests
- 16.8. Check results
- 16.9. Expect.pm
- 16.10. Networking
- 16.11. Network devices
- 16.12. Devices connected to Serial or Parallel port
- 16.13. X10 protocol
- 17. Database Testing
- 17.1. Database testing
- 17.2. A couple of tools
- 17.3. Test::More and DBI
- 17.4. Test::DatabaseRow
- 17.5. Test::DatabaseRow fail
- 17.6. Test::DatabaseRow tests more than one row
- 17.7. Test::DatabaseRow tests more than one row - failure
- 17.8. Test::DatabaseRow without SQL
- 18. Microsoft Windows GUI Testing
- 18.1. GUI testing
- 18.2. Keyboard and mouse movements
- 18.3. Win32::GuiTest
- 18.4. Win32::GUIRobot
- 18.5. Calculator
- 18.6. Launch the application
- 18.7. Locale
- 18.8. Close the application
- 18.9. Using the Keyboard
- 18.10. Check the children
- 18.11. Fetch content of a control
- 18.12. Window location
- 18.13. Move the mouse
- 18.14. Move the cursor around the edges
- 18.15. Close the window by a mouse click
- 18.16. Calculate using the mouse
- 18.17. The full calc.pl example
- 18.18. Installing Win32::GuiTest
- 18.19. Tools
- 19. Appendixes
- 19.1. Test related CPAN Modules
- 19.2. Generic modules
- 19.3. Web testing
- 19.4. GUI testing
- 19.5. Other sources of information
- 19.6. Test Realistically
- 19.7. Test Unrealistically
- 19.8. File System testing