1 / 47

Introduction to Software Testing (Paul deGrandis)

Introduction to Software Testing (Paul deGrandis). [Reading assignment: Chapter 15, pp. 231-252 and notes by Paul deGrandis]. Overview. Terms and Definitions Tool Overview Static Checkers Unit Testing Coverage and Profiling Memory Analysis Bug Reporting and Tracking

hetal
Download Presentation

Introduction to Software Testing (Paul deGrandis)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Software Testing(Paul deGrandis) [Reading assignment: Chapter 15, pp. 231-252 and notes by Paul deGrandis]

  2. Overview • Terms and Definitions • Tool Overview • Static Checkers • Unit Testing • Coverage and Profiling • Memory Analysis • Bug Reporting and Tracking • Continuous Integration

  3. NOTE • All the material and examples from here on are generated using a single makefile. • Log into tux, then:wget http://www.pauldee.org/vandvmakefilemv vandvmakefile Makefile • Export your classpath:export CLASSPATH=`pwd`/junit/junit-4.4.jar:`pwd`/emma/emma.jar:. • To make and download all tools and examples:make

  4. Tool Overview • Verification • Static Checking • Unit Tests for code correctness • Memory and performance specifications • Validation • Unit Tests for behavior and requirements

  5. Static Checkers • Does not execute the code • Finds suspicious code or security vulnerabilities • Tools • C - SPLINT,GCC Warnings • Java - FindBugs, PMD Cyclone - a safe C GNU Compiler Collection FindBugs - Find Bugs in Java

  6. Static Checkers - C Screenshots

  7. Static Checkers - C Demo • Installation of SPLINT • Compiling using GCC Warning • Running Splint

  8. Static Checkers - C Demo • Installation of SPLINT • Download wget http://www.splint.org/downloads/splint-3.1.2.src.tgz • Untartar -xzvf splint-3.1.2.src.tgz • Make (during make, splint checks itself)cd splint-3.1.2/./configuremake

  9. Static Checkers - C Demo • Compiling using GCC Warnings • see the screenshot three slides back

  10. Static Checkers - C Demo • Running SPLINT • Simple and Basicsplint -preproc +weak +show-summary +stats ../src/*.c • Dependable Softwaresplint -preproc +checks +show-summary +stats ../src/*.c

  11. Static Checkers - Java Screenshots

  12. Static Checkers - Java Demo • Installation of FindBugs • Running FindBugs

  13. Static Checkers - Java Demo • Installation of FindBugs • Downloadwget http://prdownloads.sourceforge.net/findbugs/findbugs-1.2.1.tar.gz • Untartar -xvzf findbugs-1.2.1.tar.gz cd findbugs-1.2.1

  14. Static Checkers - Java Demo • Running FindBugs • Run It./findbugs

  15. Unit Tests • Validate a unit of code; smallest testable part • Executes the code in a sandboxed environment • Testing mostly for functional requirements • can also test some non-functional requirements • Many approaches and schools of thought • History Based, Risk Based, Data Path, DOE

  16. Unit Tests Frameworks-C Screenshots Check Unit Test Framework http://check.sourceforge.net

  17. Unit Tests Frameworks-C Demo http://check.sourceforge.net/doc/check.html/index.html • Installation of Check • Writing a Check unit test • Compiling your test(s) • Running your test(s)

  18. Unit Tests Frameworks-C Demo • Installation of Check • Downloadwget http://downloads.sourceforge.net/check/check-0.9.5.tar.gz • Untartar -xvzf check-0.9.5.tar.gz • Make (notice the GCC warnings passed)cd check-0.9.5./configuremake

  19. Unit Tests Frameworks-C Demo • Writing a Check unit test • Write your test fixtures • Write your test(s) • Write your test suite • Write your main method (execute your suite)

  20. Unit Tests Frameworks-C Demo • Writing a Check unit test • Write your test fixtures

  21. Unit Tests Frameworks-C Demo • Writing a Check unit test • Write your test(s)

  22. Unit Tests Frameworks-C Demo • Writing a Check unit test • Write your test suite

  23. Unit Tests Frameworks-C Demo • Writing a Check unit test • Write your main method (execute your suite)

  24. Unit Tests Frameworks-C Demo • Compiling your test(s) • See README in check/check-example/square

  25. Unit Tests Frameworks-C Demo • Running your test(s) • See README in check/check-example/square

  26. Unit Tests Frameworks-Java Screenshots

  27. Unit Tests Frameworks-Java Demo http://junit.sourceforge.net/ (look at the cookbook) • Installation of Junit • Writing a Junit unit test • Compiling your test(s) • Just use javac • Running your test(s) • just use java

  28. Unit Tests Frameworks-Java Demo • Installation of Junit • Downloadwget http://downloads.sourceforge.net/junit/junit-4.4.jar • Add the jar to your classpathexport CLASSPATH=$CLASSPATH:`pwd`/junit-4.4.jar:.

  29. Unit Tests Frameworks-Java Demo • Writing a Junit unit test • Write your test fixtures • Write your test(s) • Write your test suite • Write your main method (execute your suite)

  30. Unit Tests Frameworks-Java Demo • Writing a Junit unit test • Write your test fixtures

  31. Unit Tests Frameworks-Java Demo • Writing a Junit unit test • Write your test(s)

  32. Unit Tests Frameworks-Java Demo • Writing a Junit unit test • Write your test suite(s)

  33. Unit Tests Frameworks-Java Demo • Writing a Junit unit test • Write your main method

  34. Code Coverage • Degree to how much code was tested (E.g., How confident are we in our tests and code) • Criteria: • Statement - Has each line been executed • Condition - Every evaluation (if/else, try/catch, switch, loop) • Path - Every route of code

  35. Code Coverage - C Screenshots GCC - GCOV

  36. Code Coverage - C Demo See the Screenshot one slide back

  37. Code Coverage - Java Screenshots http://emma.sourceforge.net/intro.html EMMA

  38. Code Coverage - Java Demo • Installation of Emma • Downloadwget http://downloads.sourceforge.net/emma/emma-2.0.5312-lib.zip • Unzipunzip emma-2.0.5312-lib.zip • Instrument Your Codejava -cp emma.jar:./sample:../junit/junit-4.4.jar emma instr -outdir ./sampleout -cp ./sample/ SimpleTest • Run Your Code and Generate a reportjava SimpleTestjava -cp emma.jar emma report -r html -in sampleout/coverage.em,sampleout/coverage.ec

  39. Memory Analysis • Sandboxes an application in a VM • Uses: • Memory Leak - allocate memory, but don’t free • Buffer Overflow - access memory outside of a fixed buffer • Profiling - performance analysis

  40. Memory Analysis - C Screenshots Valgrind

  41. Memory Analysis - C Demo • Installation of Valgrind • Downloadwget http://downloads.sourceforge.net/check/check-0.9.5.tar.gz • Untartar -xvjf valgrind-3.2.3.tar.bz2 • Make (notice the GCC warnings passed)cd valgrind-3.2.3./configuremake

  42. Memory Analysis - C Demo • Running of Valgrind • Compile with debugging enabledgcc -g myprog.c • Run Valgrindvalgrind --leak-check=yes myprog arg1 arg2 • Full tutorial and infoformationhttp://valgrind.org/docs/manual/quick-start.html#quick-start.intro

  43. Memory Analysis - Java Screenshots JConsole

  44. Issue and Bug Tracking • Organizes and tracks issues, enhancements, features, and bugs in a software system • Usually contains a database backend and a web frontend • Generate report of project and team metrics and productivity

  45. Issue and Bug Tracking • Trac (http://trac.edgewall.org/) • Roundup (http://roundup.sourceforge.net/) • Tracker (http://tracker.rubyforge.org/)

  46. Continuous Integration • Committing changes early and often • Building and testing at least nightly • If code breaks, revert • Integration issues discovered early as developers work with the latest code

  47. You now know … • … static checkers • … unit testing tools • … coverage and profiling tools • … memory analysis tools • … Bug reporting and tracking tools

More Related