Software testing
Topics covered <ul><li>System testing </li></ul><ul><li>Component testing </li></ul><ul><li>Test case design </li></ul><ul...
The testing process <ul><li>Component testing  </li></ul><ul><ul><li>Testing of individual program components; </li></ul><...
Testing phases
Testing process goals <ul><li>Validation testing </li></ul><ul><ul><li>To demonstrate to the developer and the system cust...
The software testing process
<ul><li>Only exhaustive testing can show a program is free from defects. However, exhaustive testing is impossible, </li><...
System testing <ul><li>Involves integrating components to create a system or sub-system. </li></ul><ul><li>May involve tes...
Integration testing <ul><li>Involves building a system from its components and testing it for problems that arise from com...
Incremental integration testing
Release testing <ul><li>The process of testing a release of a system that will be distributed to customers. </li></ul><ul>...
Black-box testing
Testing guidelines <ul><li>Testing guidelines are hints for the testing team to help them choose tests that will reveal de...
Use cases <ul><li>Use cases can be a basis for deriving the tests for a system. They help identify operations to be tested...
Collect weather data sequence chart
Performance testing <ul><li>Part of release testing may involve testing the emergent properties of a system, such as perfo...
Stress testing <ul><li>Exercises the system beyond its maximum design load. Stressing the system often causes defects to  ...
Component testing <ul><li>Component or unit testing is the process of testing individual components in isolation. </li></u...
Test case design <ul><li>Involves designing the test cases (inputs and outputs) used to test the system. </li></ul><ul><li...
Requirements based testing <ul><li>A general principle of requirements engineering is that requirements should be testable...
Test automation <ul><li>Testing is an expensive process phase. Testing workbenches provide a range of tools to reduce the ...
A testing workbench
WATIR (Web Application Testing in Ruby) <ul><li>Free, open-source functional testing tool for automating browser-based tes...
DEVELOPING TESTS WITH WATIR <ul><li>WATIR provides a toolkit for automated tests to be developed and run against a web bro...
<ul><li>Developing a test case requires you to know the HTML that’s in the web page(s) you are testing. </li></ul>DEVELOPI...
WATIR Syntax <ul><li>Create a file that has the extension .rb, for example testlogin.rb </li></ul><ul><li>Enter the line: ...
<ul><li>Site Navigation </li></ul><ul><li>To direct your test script to the web application  </li></ul><ul><li>you are tes...
<ul><li>Hyperlinks </li></ul><ul><li>You can use Watir to click hyperlinks by using  </li></ul><ul><li>the text attribute ...
WATIR Syntax <ul><li>Hyperlinks </li></ul>require ‘watir’ ie=Watir::IE.start(“http://www.earthlink.net”); ie.link(:url, “h...
<ul><li>Radio Buttons </li></ul><ul><li>Watir can set/unset radio buttons/checkboxes </li></ul><ul><li>Consider the follow...
<ul><li>Entering Data into a Web Page </li></ul><ul><li>Watir can set/unset radio buttons/checkboxes </li></ul><ul><li>Con...
require 'watir' #ie = Watir::IE.new ie = Watir::IE.start(&quot;http://www.hotmail.com&quot;) ie.text_field(:name, &quot;lo...
require 'watir' ie = Watir::IE.start(&quot;http://www.cis.famu.edu&quot;) ie.link(:url, &quot;http://www.cis.famu.edu/peop...
Test cases for ROI System <ul><li>Use Ruby to develop a test script for each of the collaboration diagrams you designed. <...
Key points <ul><li>Testing can show the presence of faults in a system; it cannot prove there are no remaining faults. </l...
Key points <ul><li>Interface testing is designed to discover defects in the interfaces of composite components. </li></ul>...
Upcoming SlideShare
Loading in …5
×

Chapter 23: Software Testing

964 views

Published on

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
964
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
28
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Chapter 23: Software Testing

  1. 1. Software testing
  2. 2. Topics covered <ul><li>System testing </li></ul><ul><li>Component testing </li></ul><ul><li>Test case design </li></ul><ul><li>Test automation </li></ul>
  3. 3. The testing process <ul><li>Component testing </li></ul><ul><ul><li>Testing of individual program components; </li></ul></ul><ul><ul><li>Usually the responsibility of the component developer (except sometimes for critical systems); </li></ul></ul><ul><ul><li>Tests are derived from the developer’s experience. </li></ul></ul><ul><li>System testing </li></ul><ul><ul><li>Testing of groups of components integrated to create a system or sub-system; </li></ul></ul><ul><ul><li>The responsibility of an independent testing team; </li></ul></ul><ul><ul><li>Tests are based on a system specification. </li></ul></ul>
  4. 4. Testing phases
  5. 5. Testing process goals <ul><li>Validation testing </li></ul><ul><ul><li>To demonstrate to the developer and the system customer that the software meets its requirements; </li></ul></ul><ul><ul><li>A successful test shows that the system operates as intended. </li></ul></ul><ul><li>Defect testing </li></ul><ul><ul><li>To discover faults or defects in the software where its behaviour is incorrect or not in conformance with its specification; </li></ul></ul><ul><ul><li>A successful test is a test that makes the system perform incorrectly and so exposes a defect in the system. </li></ul></ul>
  6. 6. The software testing process
  7. 7. <ul><li>Only exhaustive testing can show a program is free from defects. However, exhaustive testing is impossible, </li></ul><ul><li>Testing policies define the approach to be used in selecting system tests: </li></ul><ul><ul><li>All functions accessed through menus should be tested; </li></ul></ul><ul><ul><li>Combinations of functions accessed through the same menu should be tested; </li></ul></ul><ul><ul><li>Where user input is required, all functions must be tested with correct and incorrect input. </li></ul></ul>Testing policies
  8. 8. System testing <ul><li>Involves integrating components to create a system or sub-system. </li></ul><ul><li>May involve testing an increment to be delivered to the customer. </li></ul><ul><li>Two phases: </li></ul><ul><ul><li>Integration testing - the test team have access to the system source code. The system is tested as components are integrated. </li></ul></ul><ul><ul><li>Release testing - the test team test the complete system to be delivered as a black-box. </li></ul></ul>
  9. 9. Integration testing <ul><li>Involves building a system from its components and testing it for problems that arise from component interactions. </li></ul><ul><li>Top-down integration </li></ul><ul><ul><li>Develop the skeleton of the system and populate it with components. </li></ul></ul><ul><li>Bottom-up integration </li></ul><ul><ul><li>Integrate infrastructure components then add functional components. </li></ul></ul><ul><li>To simplify error localisation, systems should be incrementally integrated. </li></ul>
  10. 10. Incremental integration testing
  11. 11. Release testing <ul><li>The process of testing a release of a system that will be distributed to customers. </li></ul><ul><li>Primary goal is to increase the supplier’s confidence that the system meets its requirements. </li></ul><ul><li>Release testing is usually black-box or functional testing </li></ul><ul><ul><li>Based on the system specification only; </li></ul></ul><ul><ul><li>Testers do not have knowledge of the system implementation. </li></ul></ul>
  12. 12. Black-box testing
  13. 13. Testing guidelines <ul><li>Testing guidelines are hints for the testing team to help them choose tests that will reveal defects in the system </li></ul><ul><ul><li>Choose inputs that force the system to generate all error messages; </li></ul></ul><ul><ul><li>Design inputs that cause buffers to overflow; </li></ul></ul><ul><ul><li>Repeat the same input or input series several times; </li></ul></ul><ul><ul><li>Force invalid outputs to be generated; </li></ul></ul><ul><ul><li>Force computation results to be too large or too small. </li></ul></ul>
  14. 14. Use cases <ul><li>Use cases can be a basis for deriving the tests for a system. They help identify operations to be tested and help design the required test cases. </li></ul><ul><li>From an associated sequence diagram, the inputs and outputs to be created for the tests can be identified. </li></ul>
  15. 15. Collect weather data sequence chart
  16. 16. Performance testing <ul><li>Part of release testing may involve testing the emergent properties of a system, such as performance and reliability. </li></ul><ul><li>Performance tests usually involve planning a series of tests where the load is steadily increased until the system performance becomes unacceptable. </li></ul>
  17. 17. Stress testing <ul><li>Exercises the system beyond its maximum design load. Stressing the system often causes defects to come to light. </li></ul><ul><li>Stressing the system test failure behaviour.. Systems should not fail catastrophically. Stress testing checks for unacceptable loss of service or data. </li></ul><ul><li>Stress testing is particularly relevant to distributed systems that can exhibit severe degradation as a network becomes overloaded. </li></ul>
  18. 18. Component testing <ul><li>Component or unit testing is the process of testing individual components in isolation. </li></ul><ul><li>It is a defect testing process. </li></ul><ul><li>Components may be: </li></ul><ul><ul><li>Individual functions or methods within an object; </li></ul></ul><ul><ul><li>Object classes with several attributes and methods; </li></ul></ul><ul><ul><li>Composite components with defined interfaces used to access their functionality. </li></ul></ul>
  19. 19. Test case design <ul><li>Involves designing the test cases (inputs and outputs) used to test the system. </li></ul><ul><li>The goal of test case design is to create a set of tests that are effective in validation and defect testing. </li></ul><ul><li>Design approaches: </li></ul><ul><ul><li>Requirements-based testing; </li></ul></ul><ul><ul><li>Partition testing; </li></ul></ul><ul><ul><li>Structural testing. </li></ul></ul>
  20. 20. Requirements based testing <ul><li>A general principle of requirements engineering is that requirements should be testable. </li></ul><ul><li>Requirements-based testing is a validation testing technique where you consider each requirement and derive a set of tests for that requirement. </li></ul>
  21. 21. Test automation <ul><li>Testing is an expensive process phase. Testing workbenches provide a range of tools to reduce the time required and total testing costs. </li></ul><ul><li>Systems such as Junit support the automatic execution of tests. </li></ul><ul><li>Most testing workbenches are open systems because testing needs are organisation-specific. </li></ul><ul><li>They are sometimes difficult to integrate with closed design and analysis workbenches. </li></ul>
  22. 22. A testing workbench
  23. 23. WATIR (Web Application Testing in Ruby) <ul><li>Free, open-source functional testing tool for automating browser-based tests of web applications. </li></ul><ul><li>http://wtr.rubyforge.org/ </li></ul><ul><li>WATIR automatically clicks links, fills in forms, and presses buttons </li></ul><ul><li>WATIR will not work with ActiveX plugin components, Java Applets, Macromedia Flash, or other plugin applications </li></ul>
  24. 24. DEVELOPING TESTS WITH WATIR <ul><li>WATIR provides a toolkit for automated tests to be developed and run against a web browser. </li></ul><ul><li>The tests are developed using a scripting language. </li></ul><ul><li>The language has function calls to: </li></ul><ul><li>- set/unset checkboxes </li></ul><ul><li>- enter text in text fields </li></ul><ul><li>- make selections in dropdowns </li></ul><ul><li>- press buttons </li></ul>
  25. 25. <ul><li>Developing a test case requires you to know the HTML that’s in the web page(s) you are testing. </li></ul>DEVELOPING TESTS WITH WATIR <a href=&quot;http://ppg.com/titles&quot;> Jackson </a> <ul><li>Watir can use different attributes of a tag to manipulate that object </li></ul><input type=submit value=&quot;Search&quot; name=btn>
  26. 26. WATIR Syntax <ul><li>Create a file that has the extension .rb, for example testlogin.rb </li></ul><ul><li>Enter the line: </li></ul><ul><li>require 'watir </li></ul><ul><li>To create a test instance of Internet Explorer, enter the following in your test script: </li></ul><ul><li>ie = Watir::IE.new </li></ul><ul><li>To create an instance of Internet Explorer and navigate to the site with one statement: </li></ul><ul><li>ie = Watir::IE.start(&quot;http://www.famu.edu&quot;) </li></ul>require ‘watir’ ie=Watir::IE.start(“http://www.famu.edu”); testlogin.rb
  27. 27. <ul><li>Site Navigation </li></ul><ul><li>To direct your test script to the web application </li></ul><ul><li>you are testing, use the goto command. </li></ul><ul><li>ie.goto(&quot;http://mytestsite&quot;) </li></ul>WATIR Syntax require ‘watir’ ie=Watir::IE. New ie.goto(&quot;http://mytestsite&quot;) testlogin2.rb
  28. 28. <ul><li>Hyperlinks </li></ul><ul><li>You can use Watir to click hyperlinks by using </li></ul><ul><li>the text attribute or the url attribute of the tag </li></ul><ul><li>Consider the following hyperlink: </li></ul><ul><li><a href=&quot;http://webmail.earthlink.net&quot; >Web Mail</a> </li></ul><ul><li>The hyperlink can be clicked by: </li></ul><ul><li>ie.link(:text, “Web Mail&quot;).click OR </li></ul><ul><li>ie.link(:url, http://webmail.earthlink.net&quot; ).click </li></ul>WATIR Syntax
  29. 29. WATIR Syntax <ul><li>Hyperlinks </li></ul>require ‘watir’ ie=Watir::IE.start(“http://www.earthlink.net”); ie.link(:url, “http://webmail.earthlink.net&quot; ).click test4.rb
  30. 30. <ul><li>Radio Buttons </li></ul><ul><li>Watir can set/unset radio buttons/checkboxes </li></ul><ul><li>Consider the following hyperlink: </li></ul><ul><li><input type = &quot;checkbox&quot; name = &quot;checkme&quot; value = &quot;1&quot;> </li></ul><ul><li>The radio button can be set by: </li></ul><ul><li>ie.checkbox(:name, &quot;checkme&quot;).set </li></ul>WATIR Syntax
  31. 31. <ul><li>Entering Data into a Web Page </li></ul><ul><li>Watir can set/unset radio buttons/checkboxes </li></ul><ul><li>Consider the following textfield: </li></ul><ul><li><input name=&quot;login&quot; type=&quot;text&quot; id=&quot;i0116&quot; maxlength=&quot;113&quot; > </li></ul><ul><li>The text can be entered with the following command: </li></ul><ul><li>ie.text_field(:name, &quot;login&quot;).set(&quot;clementallen@hotmail.com&quot;) </li></ul>WATIR Syntax
  32. 32. require 'watir' #ie = Watir::IE.new ie = Watir::IE.start(&quot;http://www.hotmail.com&quot;) ie.text_field(:name, &quot;login&quot;).set(&quot;clementallen@hotmail.com&quot;) ie.text_field(:name, &quot;passwd&quot;).set(&quot;44444444&quot;) ie.radio(:index, 3).set ie.button(:value, &quot; Sign In &quot;).click
  33. 33. require 'watir' ie = Watir::IE.start(&quot;http://www.cis.famu.edu&quot;) ie.link(:url, &quot;http://www.cis.famu.edu/people.html&quot;).click ie.link(:text, &quot;Faculty&quot;).click ie.link(:url, &quot;http://www.cis.famu.edu/profile/profile-allen.html&quot;).click
  34. 34. Test cases for ROI System <ul><li>Use Ruby to develop a test script for each of the collaboration diagrams you designed. </li></ul>
  35. 35. Key points <ul><li>Testing can show the presence of faults in a system; it cannot prove there are no remaining faults. </li></ul><ul><li>Component developers are responsible for component testing; system testing is the responsibility of a separate team. </li></ul><ul><li>Integration testing is testing increments of the system; release testing involves testing a system to be released to a customer. </li></ul><ul><li>Use experience and guidelines to design test cases in defect testing. </li></ul>
  36. 36. Key points <ul><li>Interface testing is designed to discover defects in the interfaces of composite components. </li></ul><ul><li>Equivalence partitioning is a way of discovering test cases - all cases in a partition should behave in the same way. </li></ul><ul><li>Structural analysis relies on analysing a program and deriving tests from this analysis. </li></ul><ul><li>Test automation reduces testing costs by supporting the test process with a range of software tools. </li></ul>

×