❮ Index
❯
TOC: Test Automation Using Perl
- Preface
- Basic Testing Framework in Perl
- Things we are going to test
- Testing a simple Perl module
- Calculator test
- Test with expected results
- More test cases, more output
- Complex output
- ok, not ok
- Print only ok/not ok
- Refactor - Write the ok function
- Introducing Test::Simple
- Test::Simple when everything is ok
- Test::Simple - missing test
- Test::Simple - too many tests
- Add names to the tests
- Exercise: Write tests for fibo
- Exercise: Write a test to test the Anagram checker
- Exercise: Enlarge the test
- Solution: Write tests for fibo
- Solution: Write a test to test the Anagram checker
- Solution: Enlarge our test suite
- Refactor larger test suite
- Forget about your "plan", use "no_plan"
- use BEGIN block with Test::Simple
- Put the test cases in an external file
- Large test suite
- Harness
- Harness on success
- Harness on too few tests
- prove
- Packaging as people do for CPAN
- Makefile.PL for ExtUtils::MakeMaker
- Makefile.PL for Module::Install
- Build.PL
- Directories under t and prove
- Simple CPAN-like module
- Commands for CPAN release
- Exercise: Add tests
- Test::Simple
- Test::More
- Moving over to Test::More
- Test::Simple ok( trueness, name);
- Test::More ok( trueness, name);
- Test::More is( value, expected_value, name);
- Test::More isnt( value, not_expected_value, name);
- Test::More isnt undef
- note( message ) or diag( message );
- (note or diag) explain( a_variable );
- TODO
- TODO Verbose output
- TODO: unexpected success
- TODO: unexpected success (the code)
- MyTools with various functions
- like(value, qr/expected regex/, name);
- like(value, qr/expected regex/, name);
- Another example with like
- cmp_ok( this, op, that, name);
- is_deeply( complex_structure, expected_complex_structure, name);
- Function returning data from bug-tracker
- is_deeply on a hash
- Platform dependent tests
- SKIP some tests
- locale
- Stop running current test script
- Stop all the test scripts
- Exercises
- Test coverage using Devel::Cover
- Test coverage report example
- Declare your plan at execution time
- done_testing
- plan tests, no_testing, done_testing
- Compute test plan
- subtest with plan
- subtest with implicit done_testing
- subtest to restrict scope
- skip all
- Exercise: skip test
- Exercise: use coverage
- Test blocks (use subtest instead)
- Counting tests in the small blocks (use subtest instead)
- Test libraries
- Multiple expected values
- Multiple expected values revised
- Adding information with diag
- My own test functions
- My own test functions with Test Builder level
- Create a test module
- Test::Builder
- Test::Builder object is a singleton
- Skip on the fly
- Skip on the fly based on earlier tests
- Code emitting warnings
- Test::NoWarnings
- Test::FailWarnings
- Test with warnings
- Testing for warnings
- Testing for warnings - different warning
- Testing for warnings - missing warning
- Test::Warn
- Test for no warnings - the hard way
- No other warnings using Test::NoWarnings
- No other warnings Test::FailWarnings
- unexpected warnings Test::NoWarnings, Test::FailWarnings
- Test::Exception
- Exercise: improve test module
- Exercise: add is_max
- Exercise: is_between
- Exercise: test sum
- Exercise: Test::Exception
- Solution: is_between
- Solution: test sum
- Perl Best Practices - Perl::Critic
- Verify code layout
- Why number the test files?
- Test::Differences
- Test::Deep
- Test::File
- Test::LongString
- Test::Most
- Test::Trap
- Test::Fatal
- Test::XPath
- Sample script for testing Client-Server
- Sample script for testing Client-Server Win32
- Exercise for Test::Builder
- Exercise: Math::RPN
- Exercise: exceptions
- Solution
- Mocking
- What is Mocking?
- Test Doubles
- Test Doubles explained
- What is Monkey Patching?
- When is mocking useful?
- Mocking in various situations
- Application using random
- Mock random generator in BEGIN
- Mock random generator Mock::Sub
- Function that (also) writes to STDOUT or STDERR
- Capture STDOUT and STDERR in functions call
- Code with STDIN
- Mock STDIN
- Simple game to test
- Test simple game (small)
- Test simple game (big)
- Test simple game (exact)
- Exercise: test game
- Testing time-dependent module
- Module with operation based on date
- Mocking fixed absolute time
- Module with session timeout
- Mocking relative Time
- Mocking class
- Application using the class
- Testing the 3rd party class
- Testing our app using the 3rd party class
- Testing our app mocking the 3rd party class
- Mocking function of external web call
- Test the application end-to-end
- Mocked web test
- Mocking to reproduce error in our function
- Mocking exception
- Using MetaCPAN::Client
- Mocking MetaCPAN::Client
- Override printing functions (mocking)
- Monkey Patching
- Test STDIN
- Test::Class
- Running and reporting tests
- BDD - Behavior Driven Development
- Command line application
- bc - An arbitrary precision calculator language
- Normal operation
- Expect.pm
- Simple computation - adding two values
- Results
- Reduce output - turn it into a test script
- Output
- Expect and BAIL_OUT
- More than one test
- Output
- External test file
- Random regression tests
- Random and regression testing
- Random and regression testing - slight improvement
- Results
- Expect multiple values
- Test::Expect
- Capturing both STDOUT and STDERR
- Capturing both STDOUT and STDERR manually
- Capturing both STDOUT and STDERR using IPC::Run3
- Capture::Tiny
- Test::Snapshots
- Exercise: Expect
- Networking devices
- Introduction - pick the right abstraction level
- Socket level programming using Socket.pm
- Newline
- Socket level programming using IO::Socket
- Net::Telnet
- Net::Telnet for HTTP
- Net::Telnet configure VLAN
- ftp using Net::FTP
- ssh using Net::SSH
- LWP::Simple
- LWP::UserAgent
- WWW::Mechanize
- WWW::Mechanize for Google
- Exercise: Search on Financial Times
- Exercise: Compare exchange rates
- Exercise: Telnet or SSH to Unix machines
- Introduction
- Connect to the device
- Reduce timeout
- Exercise: Telnet
- Our test script
- Web Applications
- What can be tested ?
- Extreme web site testing
- Tools
- Small test HTTP server
- Fetching a static page
- Fetching a not-existing static page
- Checking good HTML
- Checking bad HTML
- What is this bad HTML ?
- HTML::Tidy and Test::HTML::Tidy
- Test using W3C validator
- Use a local copy of the W3C validator
- LWP::Simple and LWP
- WWW::Mechanize
- Web based Calculator with WWW::Mechanize
- Testing with WWW::Mechanize
- Test::WWW::Mechanize
- Login to Act using Mechanize
- More things to test
- Test without server Test::WWW::Mechanize::PSGI
- Test page with JavaScript
- Selenium
- Selenium documentation
- Selenium IDE
- Launch Selenium server
- Selenium DuckDuckGo
- Selenium using Chrome
- Selenium DuckDuckGo Search
- Selenium DuckDuckGo Test
- Selenium locator
- Selenium locator example
- Selenium content
- Selenium in the calc example
- Selenium examples with JavaScript
- Selenium examples with Ajax
- WWW::Mechanize::PhantomJS
- Testing Dancer
- Exercies: MetaCPAN
- Exercise: blogs.perl.org
- Exercise: Testing Smolder
- Exercise: Act
- Servers
- Testing networking devices
- Database Testing
- Database access using Perl DBI
- Advanced Database access using Perl DBI
- Database access using DBIx::Class
- Microsoft Windows GUI Testing
- GUI testing
- Keyboard and mouse movements
- Win32::GuiTest
- Win32::GUIRobot
- Calculator
- Launch the application
- Locale
- Close the application
- Using the Keyboard
- Check the children
- Fetch content of a control
- Window location
- Move the mouse
- Move the cursor around the edges
- Close the window by a mouse click
- Calculate using the mouse
- The full calc.pl example
- Installing Win32::GuiTest
- Tools
- Internet Explorer
- X-Windows
- X11
- X11 Tools
- X11::GUITest
- LDTP - Linux Desktop Testing Project
- Manual steps
- X11: Launch the application
- Let's see the coordinates
- Where is this top left corner ?
- And let's see the rest of the coordinates
- Smooth on the edges
- Closing the window
- Placing the cursor on one of the buttons and clicking on it
- So let's do all the calculations
- Fetch the list of Child Windows
- Locate the Child Windows
- Using the keyboard
- Separate the keystrokes
- Full solution for xcalc
- Appendixes
- Other
- Devel::Cover script
- Can module be loaded? use_ok and require_ok
- can_ok('Class', qw(method_a method_b));
- All the tests
- Smolder
- Exercise: Smolder
- Mocking get in LWP::Simple
- Read CSV file as array of hashes
- Sort array using sort and sort_by
- Range iterator
- Benchmark
- Bubble sort
- Insert sort
- Merge sort
- Quicksort
- Timsort
- Traverse directory tree
- Traverse directory tree with call back
- Linear search in unorderd array
- Binary search in sorted array
- Convert curl command with -F to LWP::UserAgent
- Modify time anomality in two files