TAP::Formatter::Spreadsheet - Perl extension for formatting TAP Test Harness output to Spreadsheet excel output
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 );
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.
my $fmt = $class->new({ %args });
1 verbose Print individual test results (and more) to STDOUT. 0 normal
filename is used as accessor for the excel filename where the results are written. The default value is __example.xls
filename
__example.xls
$fmt->filename("hi.xls")
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
1
$fmt->number_of_sheets(4)
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
sheetname_format
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 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
chart_name
Pie_Chart
$fmt->chart_name("Pie");
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
chart_type
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 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
summary_sheet_name
Summary
$fmt->summary_sheet_name("Tests_Summary");
test_todo_ok_format is used to set the format used for successful to-do.
test_todo_ok_format
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 is used to set the format used for unsuccessful to-do.
test_todo_not_ok_format
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 is used to set the format used for successful skip values.
test_skip_ok_format
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 is used to set the format used for successful test 'ok' values.
test_ok_format
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 is used to set the format used for unsuccessful test 'not ok' values.
test_not_ok_format
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 is used to set the format used for plan values.
test_plan_format
Default Value is 'bg_color' => 'silver', 'color' => 'magenta', 'border' => 1
$fmt->test_plan_format( { 'bg_color' => 'green', 'color' => 'pink', 'border' => 1 } );
test_comment_format is used to set the format used for comment values.
test_comment_format
Default Value is 'bg_color' => 'silver', 'color' => 'purple', 'border' => 1
$fmt->test_comment_format( { 'bg_color' => 'pink', 'color' => 'blue', 'border' => 1 } );
summary_header_format is used to set the format used for summary page header values.
summary_header_format
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 is used to set the format used for summary text/stat values.
summary_format
$self->summary_format( { 'bg_color' => 'green', 'color' => 'red', 'border' => 1 } );
$html = $fmt->summary( $aggregator )
summary produces a summary report after all tests are run. $aggregator should be a TAP::Parser::Aggregator.
summary
$aggregator
TAP::Formatter::Console - the default TAP formatter used by TAP::Harness
Spreadsheet::WriteExcel - Module used to write spreadsheet excel
Murugesan Kandasamy <Murugesan.Kandasamy@gmail.com>
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 (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.
To install TAP::Formatter::Spreadsheet, copy and paste the appropriate command in to your terminal.
cpanm
cpanm TAP::Formatter::Spreadsheet
CPAN shell
perl -MCPAN -e shell install TAP::Formatter::Spreadsheet
For more information on module installation, please visit the detailed CPAN module installation guide.