The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

TAP::Formatter::Spreadsheet - Perl extension for formatting TAP Test Harness output to Spreadsheet excel output

SYNOPSIS

        use TAP::Formatter::Spreadsheet;
        my $fmt = TAP::Formatter::Spreadsheet->new;
        $fmt->filename('abc.xls');
        $fmt->number_of_sheets(4);
        $fmt->sheetname_format('first');
        $fmt->chart_name("Pie");
        $fmt->chart_type("bar");
        $fmt->summary_sheet_name("Tests_Summary");

        my @tests = glob( 't/*.t' );
        my $harness = TAP::Harness->new({ formatter => $fmt, merge => 1 });
        $harness->runtests( @tests );

DESCRIPTION

This Module provides Excel output with customizable formats for the Test::Harness output. This Module can be use for formatting the test results along with creating bar charts or pie charts based on the output results both for overall test summary and for individual tests.

This Module is based on TAP::Formatter::Console and TAP::Formatter::Base modules which are part of Core Perl distribution. TAP::Base is used as base class for this implementation.

METHODS

CONSTRUCTOR

new

  my $fmt = $class->new({ %args });

ACCESSORS

verbose

     1   verbose        Print individual test results (and more) to STDOUT.
     0   normal

filename

filename is used as accessor for the excel filename where the results are written. The default value is __example.xls

$fmt->filename("hi.xls")

number_of_sheets

filename is used as accessor for the number of sheets to be used to distribute the individual test results in the excel file. The default value is 1

$fmt->number_of_sheets(4)

sheetname_format

sheetname_format is used as accessor for the naming the sheet names which are used to distribute the individual test results in the excel file. The default value is range

List of possible values are: 'first', 'last', 'range'

first -> First testname in the sheet is used as sheet name last -> Last testname in the sheet is used as sheet name range - Numeric range of the tests which are present in that sheet is used as sheet name

$fmt->sheetname_format('first');

chart_name

chart_name is used as accessor for the naming the sheet where the charts are drawn for individual test results in the excel file. The default value is Pie_Chart

$fmt->chart_name("Pie");

chart_type

chart_type is used as accessor for the type of the charts which are drawn for individual test results in the excel file. The default value is pie

List of possible values are: 'bar', 'pie'

pie - Pie Charts are drawn bar - Bar Charts are drawn

$fmt->chart_type("bar");

summary_sheet_name

summary_sheet_name is used as accessor for the naming the sheet where the Overall test summaries for individual test results are written in the excel file. The default value is Summary

$fmt->summary_sheet_name("Tests_Summary");

test_todo_ok_format

test_todo_ok_format is used to set the format used for successful to-do.

Default Value is 'bg_color' => 'silver', 'color' => 'pink', 'border' => 1 .

    $fmt->test_todo_ok_format(
        { 'bg_color' => 'magenta', 'color' => 'orange', 'border' => 1 } );

test_todo_not_ok_format

test_todo_not_ok_format is used to set the format used for unsuccessful to-do.

Default Value is 'bg_color' => 'silver', 'color' => 'orange', 'border' => 1

    $fmt->test_todo_not_ok_format(
        { 'bg_color' => 'magenta', 'color' => 'pink', 'border' => 1 } );

test_skip_ok_format

test_skip_ok_format is used to set the format used for successful skip values.

Default Value is 'bg_color' => 'silver', 'color' => 'yellow', 'border' => 1

    $fmt->test_skip_ok_format(
        { 'bg_color' => 'yellow', 'color' => 'pink', 'border' => 1 } );

test_ok_format

test_ok_format is used to set the format used for successful test 'ok' values.

Default Value is 'bg_color' => 'silver', 'color' => 'green', 'border' => 1

        $fmt->test_ok_format(
        { 'bg_color' => 'pink', 'color' => 'yellow', 'border' => 1 } );

test_not_ok_format

test_not_ok_format is used to set the format used for unsuccessful test 'not ok' values.

Default Value is 'bg_color' => 'silver', 'color' => 'red', 'border' => 1 }

    $fmt->test_not_ok_format(
        { 'bg_color' => 'yellow', 'color' => 'red', 'border' => 1 } );

test_plan_format

test_plan_format is used to set the format used for plan values.

Default Value is 'bg_color' => 'silver', 'color' => 'magenta', 'border' => 1

        $fmt->test_plan_format(
        { 'bg_color' => 'green', 'color' => 'pink', 'border' => 1 } );

test_comment_format

test_comment_format is used to set the format used for comment values.

Default Value is 'bg_color' => 'silver', 'color' => 'purple', 'border' => 1

        $fmt->test_comment_format(
        { 'bg_color' => 'pink', 'color' => 'blue', 'border' => 1 } );

summary_header_format

summary_header_format is used to set the format used for summary page header values.

Default Value is 'bg_color' => 'green', 'color' => 'black', 'border' => 2, 'bold' => 1, 'align' => 'center'

        $fmt->summary_header_format(
        {
            'bg_color' => 'pink',
            'color'    => 'navy',
            'border'   => 1,
            'bold'     => 0,
            'align'    => 'left'
        }
    );

summary_format

summary_format is used to set the format used for summary text/stat values.

Default Value is 'bg_color' => 'silver', 'color' => 'purple', 'border' => 1

    $self->summary_format(
        { 'bg_color' => 'green', 'color' => 'red', 'border' => 1 } );

API METHODS

summary

  $html = $fmt->summary( $aggregator )

summary produces a summary report after all tests are run. $aggregator should be a TAP::Parser::Aggregator.

SEE ALSO

TAP::Formatter::Console - the default TAP formatter used by TAP::Harness

Spreadsheet::WriteExcel - Module used to write spreadsheet excel

AUTHOR

Murugesan Kandasamy <Murugesan.Kandasamy@gmail.com>

ACKNOWLDEGEMENT

John Mcnamara - For his contributions towards Spreadsheet::* Module

Steve Purkis - For his contributions towards TAP::Formatter::* Module

Prasad JP, Sivaraman M, Rajesh S and Murugaperumal R for their contribution towards testing.

COPYRIGHT AND LICENSE

Copyright (C) 2011 by Murugesan Kandasamy

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6.0 or, at your option, any later version of Perl 5 you may have available.