Nordic Perl Workshop 2013

Beyond Unit Testing
Søren Lund (slu)
slu@369.dk
We all know about unit testing


”t” directory / *.t scripts



prove command



or make test



Integrated part of CPAN/Perl culture for many
years
Testing Web Application


Multi-tier



Back-end (Perl)



Front-end (JavaScript)





Persistence (SQL / SP)

Web Services

Simple unit testing doesn't really cut it
Selenium IDE


Firefox Add-on



What it user/browser sees



Black box testing



Simply record a flow



Add assertions



Build test cases and test suites



You can even do dynamic stuff with JavaScript
soapUI


Stand-alone GUI



Web Service testing (WSDL)



Create test cases and test suites



Dynamic stuff using embedded Groovy



Also handles REST and more
Apache JMeter


Stand-alone GUI



Stress and performance testing



Mainly HTTP(S), but also e.g. FTP or JDBC



Use as a proxy to record requests/responses



Visual programming language



Output as graphs and/or CSV data
The Nightly Build


You can run Selenium IDE test suites from CLI


On a headless server use Xvfb



You can run soapUI test suites from CLI



You can run JMeter test suites from CLI



Which means you can easily add them to CI
(e.g. Jenkins)
Why go beyond?
— the average defect detection
rate is only 25 percent for unit testing, 35
percent for function testing, and 45 percent for
integration testing.

Steve McConnell, Code Complete
Testing is not enough
… software testing alone has limited
effectiveness — the average defect detection
rate is only 25 percent for unit testing, 35
percent for function testing, and 45 percent for
integration testing. In contrast, the average
effectiveness of design and code inspections
are 55 and 60 percent
Steve McConnell, Code Complete
Testing is not enough
… software testing alone has limited
effectiveness — the average defect detection
rate is only 25 percent for unit testing, 35
percent for function testing, and 45 percent for
integration testing. In contrast, the average
effectiveness of design and code inspections
are 55 and 60 percent
Steve McConnell, Code Complete

Beyond Unit Testing

  • 1.
    Nordic Perl Workshop2013 Beyond Unit Testing Søren Lund (slu) slu@369.dk
  • 2.
    We all knowabout unit testing  ”t” directory / *.t scripts  prove command  or make test  Integrated part of CPAN/Perl culture for many years
  • 3.
    Testing Web Application  Multi-tier   Back-end(Perl)  Front-end (JavaScript)   Persistence (SQL / SP) Web Services Simple unit testing doesn't really cut it
  • 4.
    Selenium IDE  Firefox Add-on  Whatit user/browser sees  Black box testing  Simply record a flow  Add assertions  Build test cases and test suites  You can even do dynamic stuff with JavaScript
  • 5.
    soapUI  Stand-alone GUI  Web Servicetesting (WSDL)  Create test cases and test suites  Dynamic stuff using embedded Groovy  Also handles REST and more
  • 6.
    Apache JMeter  Stand-alone GUI  Stressand performance testing  Mainly HTTP(S), but also e.g. FTP or JDBC  Use as a proxy to record requests/responses  Visual programming language  Output as graphs and/or CSV data
  • 7.
    The Nightly Build  Youcan run Selenium IDE test suites from CLI  On a headless server use Xvfb  You can run soapUI test suites from CLI  You can run JMeter test suites from CLI  Which means you can easily add them to CI (e.g. Jenkins)
  • 8.
    Why go beyond? —the average defect detection rate is only 25 percent for unit testing, 35 percent for function testing, and 45 percent for integration testing. Steve McConnell, Code Complete
  • 9.
    Testing is notenough … software testing alone has limited effectiveness — the average defect detection rate is only 25 percent for unit testing, 35 percent for function testing, and 45 percent for integration testing. In contrast, the average effectiveness of design and code inspections are 55 and 60 percent Steve McConnell, Code Complete
  • 10.
    Testing is notenough … software testing alone has limited effectiveness — the average defect detection rate is only 25 percent for unit testing, 35 percent for function testing, and 45 percent for integration testing. In contrast, the average effectiveness of design and code inspections are 55 and 60 percent Steve McConnell, Code Complete