Scott Smith > UR-0.39 > UR::Namespace::Command::Test::Callcount

Download:
UR-0.39.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.39   Source   Latest Release: UR-0.43

NAME ^

ur test callcount - collect callcount data from running tests into one file

SYNOPSIS ^

 # run tests in a given namespace
 cd my_sandbox/TheApp
 ur test run --recurse --callcount

 ur test callcount --output all_tests.callcount

DESCRIPTION ^

Callcount data can be used to find unused subroutines in your code. When the test suite is run with the callcount option, then for each *.t file run by the test suite, a corresponding *.callcount file is created containing information about how often all the defined subroutines were called.

The callcount file is a plain text file with three columns:

  1. The number of times this subroutine was called
  2. The name of the subroutine
  3. Where in the code this subroutine is defined

After a test suite run with sufficient coverage, subroutines with 0 calls are candidates for removal, and subs with high call counts are candidates for optimization.

OPTIONS ^

--input

Name the *.callcount input file(s). When run from the command line, it accepts a list of files separated by ','s. Input files can also be given as plain, unnamed command line arguments (bare_args). When run as a command module within another program, the input) property can be an arrayref of pathanmes.

After inputs are determined, any directories given are expanded by searching them recursively for files ending in .callcount with File::Find.

If no inputs in any form are given, then it defaults to '.', the current directory, which means all *.callcount files under the current directory are used.

--output

The pathname to write the collected data to. The user may use '-' to print the results to STDOUT.

--sort

How the collected results should be sorted before being reported. The default is 'count', which sorts incrementally by call count (the first column). 'sub' performs a string sort by subroutine name (column 2).

execute() ^

The execute() method returns an arrayref of data sorted in the appropriate way. Each element is itself an arrayref of three items: count, sub name, and sub location.

syntax highlighting: