Prevent All Java Software Defects
       with a Single Tool



                                        2010




Parasoft Proprietary and Confidential
Automated Analysis Techniques



              Application Tracing for Unit Tests
              Pattern-Based Static Code Analysis
              Runtime Error Detection
              Automated Unit Test Generation
              Data Flow Analysis
              Regression Testing




Parasoft Proprietary and Confidential
Introducing the Java Web App

                                        JPetStore Java EE Tutorial

              Spring-Based
              HSQL Database
              JSP Web Interface
              Apache Tomcat




Parasoft Proprietary and Confidential
The Problem Report

                      Similar Items not Aggregating in Shopping Cart

              Add one item to
              the cart
              Add the same
              item again
              Expected: a
              single line item
              with quantity 2
              Found: 2 line
              items each with
              quantity 1

Parasoft Proprietary and Confidential
Application Tracing for Unit Tests



              Record internal method calls inside the running
              application when the problem occurs
              Replicate the problem in a JUnit test
              Alter the JUnit test to assert the correct behavior
              Now possible solutions can be tested quickly
              without redeploying the web application




Parasoft Proprietary and Confidential
Pattern-Based Static Analysis


              Quick scan to list possible problems
              Fixing violations prevents certain classes of
              errors
              Each source file is analyzed separately
              Static analysis categories include:
                    Logical Errors
                    API Misuse
                    Typographical Errors
                    Security
                    Threads and Synchronization
                    Performance and Optimization

Parasoft Proprietary and Confidential
Runtime Error Detection


              Check for anti-patterns at runtime in the
              application
              Violations are presented in the context of real-
              world data values to stress their importance
              Runtime error categories include:
                    Threads and Synchronization
                    Performance and Optimization
                    Application Crashes
                    Functional Errors
                    Security



Parasoft Proprietary and Confidential
Automated Unit Test Generation


              Test code branches not covered by the
              application-level test
              Combine these unit tests with runtime error
              detection to check the new execution paths
              Build a baseline regression test suite




Parasoft Proprietary and Confidential
Data Flow Analysis


              Simulate hypothetical execution paths
              Detect possible errors along those paths
              Data flow analysis error categories include:
                    Exceptions
                    Optimization
                    Resource Leaks
                    API misuse
                    Security




Parasoft Proprietary and Confidential
Regression Testing


              Capture current behavior of covered code paths
                    Whether the current behavior is right or wrong
              Alert when code modifications cause a change in
              behavior
              Developers can then mark JUnit assertions as
              correct behavior to increase the severity if those
              assertions fail in the future




Parasoft Proprietary and Confidential
Java Software Problems


              Functional
              Thread concurrency
              Performance
              Regression
              Requirement Testing
              Code Review




Parasoft Proprietary and Confidential
Comparable Tools


              Static Analysis
              Data Flow Analysis
              Unit Test Framework (with Test Engineer)
              Profiler
              QA Functional Tester
              Code Review
              Code Metrics Measurement
              Code Duplication Detection
              Task Management


Parasoft Proprietary and Confidential

Java Defects

  • 1.
    Prevent All JavaSoftware Defects with a Single Tool 2010 Parasoft Proprietary and Confidential
  • 2.
    Automated Analysis Techniques Application Tracing for Unit Tests Pattern-Based Static Code Analysis Runtime Error Detection Automated Unit Test Generation Data Flow Analysis Regression Testing Parasoft Proprietary and Confidential
  • 3.
    Introducing the JavaWeb App JPetStore Java EE Tutorial Spring-Based HSQL Database JSP Web Interface Apache Tomcat Parasoft Proprietary and Confidential
  • 4.
    The Problem Report Similar Items not Aggregating in Shopping Cart Add one item to the cart Add the same item again Expected: a single line item with quantity 2 Found: 2 line items each with quantity 1 Parasoft Proprietary and Confidential
  • 5.
    Application Tracing forUnit Tests Record internal method calls inside the running application when the problem occurs Replicate the problem in a JUnit test Alter the JUnit test to assert the correct behavior Now possible solutions can be tested quickly without redeploying the web application Parasoft Proprietary and Confidential
  • 6.
    Pattern-Based Static Analysis Quick scan to list possible problems Fixing violations prevents certain classes of errors Each source file is analyzed separately Static analysis categories include: Logical Errors API Misuse Typographical Errors Security Threads and Synchronization Performance and Optimization Parasoft Proprietary and Confidential
  • 7.
    Runtime Error Detection Check for anti-patterns at runtime in the application Violations are presented in the context of real- world data values to stress their importance Runtime error categories include: Threads and Synchronization Performance and Optimization Application Crashes Functional Errors Security Parasoft Proprietary and Confidential
  • 8.
    Automated Unit TestGeneration Test code branches not covered by the application-level test Combine these unit tests with runtime error detection to check the new execution paths Build a baseline regression test suite Parasoft Proprietary and Confidential
  • 9.
    Data Flow Analysis Simulate hypothetical execution paths Detect possible errors along those paths Data flow analysis error categories include: Exceptions Optimization Resource Leaks API misuse Security Parasoft Proprietary and Confidential
  • 10.
    Regression Testing Capture current behavior of covered code paths Whether the current behavior is right or wrong Alert when code modifications cause a change in behavior Developers can then mark JUnit assertions as correct behavior to increase the severity if those assertions fail in the future Parasoft Proprietary and Confidential
  • 11.
    Java Software Problems Functional Thread concurrency Performance Regression Requirement Testing Code Review Parasoft Proprietary and Confidential
  • 12.
    Comparable Tools Static Analysis Data Flow Analysis Unit Test Framework (with Test Engineer) Profiler QA Functional Tester Code Review Code Metrics Measurement Code Duplication Detection Task Management Parasoft Proprietary and Confidential