您好,欢迎光临本网站![请登录][注册会员]  
文件名称: Automatic Testing with Perl
  所属分类: Perl
  开发工具:
  文件大小: 733kb
  下载次数: 0
  上传时间: 2012-10-01
  提 供 者: babyca******
 详细说明: By Gabor Szabo Table of Contents 1. About Perl Training Israel ....................................................................................................................1 2. Introduction...........................................................................................................................................2 2.1. Self Introduction - Who am I ? ...................................................................................................2 2.2. Self Introduction - Who are you ?..................... ..........................................................................2 3. Preface ...................................................................................................................................................3 3.1. Objectives...................................................................................................................................3 3.2. Plan of the seminar......................................................................................................................3 4. Manual testing.......................................................................................................................................4 4.1. Manual testing............................................................................................................................4 4.2. Web site testing ...........................................................................................................................4 4.3. CLI testing..................................................................................................................................4 4.4. Database testing ..........................................................................................................................4 4.5. GUI testing .................................................................................................................................5 5. Basic Testing Framework in Perl .........................................................................................................6 5.1. Testing a simple command line tool............................................................................................6 5.2. Calculator test .............................................................................................................................6 5.3. Error ! .........................................................................................................................................6 5.4. Calculator test with expected results...........................................................................................7 5.5. More difficult output ...................................................................................................................7 5.6. Print only ok/not ok.....................................................................................................................7 5.7. Write the ok function ..................................................................................................................8 5.8. Introducing Test::Simple.............................................................................................................9 5.9. Add names to the tests ..............................................................................................................10 5.10. Enlarge our test suit.................................................................................................................10 5.11. Load Test::Simple at run time .................................................................................................11 5.12. Forget about your "plan", use "no_plan".................................................................................12 5.13. Put the test cases in an external file.........................................................................................13 5.14. Harness...................................................................................................................................14 5.15. Move external call into function .............................................................................................15 5.16. Exercises: MyCalc ..................................................................................................................15 5.17. Solution: MyCalc ....................................................................................................................15 5.18. Test::Simple............................................................................................................................17 6. Test::More ...........................................................................................................................................18 6.1. Moving over to Test::More .......................................................................................................18 6.2. Test::More ok( trueness, name);................................................................................................18 6.3. Test::More is( value, expected_value, name);...........................................................................19 6.4. diag(just_a_message ); ..............................................................................................................19 6.5. like(value, qr/expected regex/, name); ......................................................................................20 6.6. cmp_ok( this, op, that, name);...................................................................................................20 6.7. is_deeply( complex_structure, expected_complex structure, name); .......................................21 6.8. TODO.......................................................................................................................................22 6.9. TODO with Harness..................................................................................................................23 6.10. Platform dependent tests .........................................................................................................23 6.11. SKIP some tests ......................................................................................................................24 6.12. My own test functions.............................................................................................................24 6.13. My own test functions - improved ..........................................................................................25 6.14. Create a test module................................................................................................................25 6.15. Test::Builder...........................................................................................................................26 6.16. Number of tests .......................................................................................................................27 6.17. Early Abnormal Exit ...............................................................................................................27 6.18. Less than planned tests - Early Normal Exit...........................................................................28 6.19. More tests than planned ..........................................................................................................29 6.20. Multiply..................................................................................................................................29 6.21. Error in the test........................................................................................................................30 6.22. Multiply - fixed .......................................................................................................................30 6.23. Multiple expected values.........................................................................................................30 6.24. Exercises ................................................................................................................................31 7. Command line application ..................................................................................................................33 7.1. bc - An arbitrary precision calculator language ........................................................................33 7.2. Normal operation ......................................................................................................................33 7.3. Expect.pm ................................................................................................................................33 7.4. Simple computation - adding two values ..................................................................................33 7.5. Results......................................................................................................................................34 7.6. Simple computation - separate send commands .......................................................................34 7.7. Simple computation - is it really working ? ..............................................................................35 7.8. Results......................................................................................................................................35 7.9. Reduce output ...........................................................................................................................36 7.10. Output.....................................................................................................................................36 7.11. More than one test...................................................................................................................36 7.12. Output.....................................................................................................................................37 7.13. External test file ......................................................................................................................37 7.14. Random regression tests..........................................................................................................38 7.15. Random and regression testing ...............................................................................................39 7.16. Random and regression testing - slight improvement.............................................................40 7.17. Results....................................................................................................................................41 7.18. Recording session ...................................................................................................................41 7.19. Capturing both STDOUT and STDERR.................................................................................41 7.20. Capturing both STDOUT and STDERR manually.................................................................42 7.21. Capturing both STDOUT and STDERR using IPC::Run3.....................................................42 8. Networking devices ..............................................................................................................................44 8.1. Introduction - pick the right abstraction level ...........................................................................44 8.2. Socket level programming using Socket.pm.............................................................................44 8.3. Socket level programming using IO::Socket.............................................................................45 8.4. Newline ....................................................................................................................................46 8.5. Net::Telnet................................................................................................................................46 8.6. Net::Telnet for HTTP................................................................................................................46 8.7. Net::Telnet configure VLAN.....................................................................................................47 8.8. ftp using Net::FTP.....................................................................................................................49 8.9. ssh using Net::SSH....................................................................................................................49 8.10. LWP::Simple ...........................................................................................................................50 8.11. LWP........................................................................................................................................51 Copyright 2007, Gabor Szabo @ Perl Training Israel iv 8.12. WWW::Mechanize..................................................................................................................51 8.13. WWW::GMail.........................................................................................................................52 8.14. Exercise: CNN Developing story ............................................................................................52 8.15. Exercise: Search on Financial Times ......................................................................................52 8.16. Exercise: Compare exchange rates..........................................................................................53 8.17. Telnet to Unix machines..........................................................................................................53 9. Servers .................................................................................................................................................54 9.1. Net::Server ...............................................................................................................................54 9.2. Skeleton Server .........................................................................................................................54 9.3. Simple Echo Server...................................................................................................................54 9.4. Echo Server ...............................................................................................................................55 9.5. Complex network servers..........................................................................................................56 10. Command Line Interface ..................................................................................................................58 10.1. Introduction .............................................................................................................................58 10.2. Connect to the device ..............................................................................................................58 10.3. Reduce timeout .......................................................................................................................59 10.4. Exercise: Telnet .......................................................................................................................60 10.5. Our test script ..........................................................................................................................60 11. Testing networking devices ...............................................................................................................64 11.1. Elements.................................................................................................................................64 11.2. Hardware setup........................................................................................................................64 11.3. Access the administrative interface.........................................................................................64 11.4. Configure devices on all sides of our box ...............................................................................64 11.5. Run tests .................................................................................................................................64 11.6. Check results ...........................................................................................................................64 11.7. Expect.pm ...............................................................................................................................65 11.8. Other modules .........................................................................................................................65 11.9. Networking.............................................................................................................................65 11.10. Network devices....................................................................................................................65 11.11. Devices connected to Serial or Parallel port .........................................................................66 11.12. X10 protocol .........................................................................................................................66 12.Web Applications ...............................................................................................................................67 12.1. What can be tested ?................................................................................................................67 12.2. Tools.......................................................................................................................................67 12.3. Small test HTTP server ...........................................................................................................67 12.4. Fetching a static page..............................................................................................................67 12.5. Fetching a not-existing static page..........................................................................................68 12.6. Checking good HTML............................................................................................................68 12.7. Checking bad HTML ..............................................................................................................69 12.8. What is this bad HTML ?........................................................................................................69 12.9. HTML::Tidy and Test::HTML::Tidy ......................................................................................70 12.10. Test using W3C validator......................................................................................................70 12.11. LWP::Simple and LWP.........................................................................................................71 12.12. WWW::Mechanize................................................................................................................71 12.13. Web based Calculator............................................................................................................71 12.14. More things to test.................................................................................................................73 Copyright 2007, Gabor Szabo @ Perl Training Israel v 12.15. Test page with JavaScript ......................................................................................................73 13. Database access using Perl DBI........................................................................................................74 13.1. Architecture of a DBI Application..........................................................................................74 13.2. Create Sample Database..........................................................................................................74 13.3. Connect to database ................................................................................................................74 13.4. SELECT with one result .........................................................................................................75 13.5. SELECT with more results .....................................................................................................75 13.6. SELECT, prepare with placeholders .......................................................................................76 13.7. SELECT, using hashref...........................................................................................................76 13.8. INSERT..................................................................................................................................76 13.9. Sample database......................................................................................................................77 13.10. Other methods .......................................................................................................................78 13.11. Attributes..............................................................................................................................78 13.12. Error handling .......................................................................................................................78 13.13. Debugging (Trace levels) ......................................................................................................79 14. Database access using Class::DBI ....................................................................................................80 14.1. Class::DBI..............................................................................................................................80 14.2. INSERT using Class::DBI ......................................................................................................80 14.3. SELECT using Class::DBI......................................................................................................80 14.4. MyDBI and MyUsers..............................................................................................................80 ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 输入关键字,在本站1000多万海量源码库中尽情搜索: