Jtest logo




Contents  Previous  Next  Index

About Static Analysis


During static analysis, Jtest analyzes source code to expose violations of coding standards, language specific "rules" that help you prevent errors.

Jtest enforces the following types of coding standards:

  • Traditional coding standards: Traditional coding standards are rules that apply to constructs within the class under test. A traditional coding standard might test whether or not a file's source code contains a construct that has a high probability of resulting in an error. For example, one traditional coding standard checks that you use "equals" instead of "==" when comparing strings (writing "==" when you should have used "equals" causes the program to check if two strings are identical, rather than check if two strings have the same value).
  • Global coding standards: Global coding standards are rules that ensure that projects use fields, methods, and classes wisely. A global coding standard might check that a project does not contain logical flaws and unclear code such as unused or overly-accessible fields, methods, and classes; such problems increase the probability of an error being introduced into the code, and may also make the code less object-oriented.
  • Metrics: Metrics are measures of the size and complexity of code. When Jtest performs static analysis, it also measures your class's and (if applicable) project's metrics; it reports all metrics in the Metrics window, and reports a static analysis violation for any class metric that is outside of the bounds that have been set for that metric.
  • Custom coding standards: Custom coding standards are rules specially tailored to your own or your group's unique coding style. For information on creating custom coding standards, refer to Creating Your Own Static Analysis Rules.

Static analysis is performed automatically when you test a class or project.

When enforcing all static analysis rules except for Global Static Analysis rules, Jtest statically analyzes the classes by parsing the .java source and applying a set of rules to it, then alerting you to any rule violations found.

When enforcing global static analysis rules, Jtest scans all of the project's .class files to collect global usage information, uses this information to check if each class violates any rules in Jtest's Global Static Analysis category, then alerts you to any violations in the classes under test. Because Jtest uses .class files (rather than .java files) to check this particular category of rules, you can perform global static analysis even when .java files are not available.

Note: Global static analysis can only be performed while testing a project.

Related Topics

Performing Static Analysis

Creating Your Own Static Analysis Rules

Viewing Class and Project Metrics

Tracking Metrics Over Time

Customizing Static Analysis


Contents  Previous  Next  Index

ParaSoft logo
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft