advertise
Perl Excel to create a test plan with perl — specially very
Hot:sun Perl Excel to create a test plan with perl    specially verysun Perl Excel to create a test plan with perl    specially verysun Perl Excel to create a test plan with perl    specially verysun Perl Excel to create a test plan with perl    specially verysun dark Perl Excel to create a test plan with perl    specially very

Today I came across a very interesting problem. I had to write a Test Case document that had quite a huge number of test cases. The interesting part was that the Procedure and the result remained same but the name of the frame and the fields were chaning. I felt that copy/paste and modification would be a complete waste of time, so wrote this perl script quickly. Does what is expected.

#!/usr/bin/perl

#===============================================================================

#

# FILE: gui.pl

#

# USAGE: ./gui.pl

#

# DESCRIPTION: Create excel TC Document using perl.

#

# OPTIONS: —

# REQUIREMENTS: —

# BUGS: —

# NOTES: —

# AUTHOR: Amit Agarwal(amit.agarwal@amit-agarwal.co.in)

# COMPANY:

# VERSION: 1.0

# CREATED: 09/14/2009 06:58:42 PM

# REVISION: —

#===============================================================================

use strict;

use warnings;

use Spreadsheet::WriteExcel;

my $procedure;

my $result;

my $frame;

my $field;

my $line;

my $row = 1;

my $workbook = Spreadsheet::WriteExcel->new(“amit_agarwal.xls”);

my $worksheet = $workbook->add_worksheet(“GUI_TC”);

# To use blod style, you can use the below format.

# my $bold = $workbook->add_format();

# $bold->set_bold();

# $worksheet->write(5, 0, “amitag”, $bold);

# We will assume that file “amit” exists in current directory

# and contains two fields per line. First field is frame name

# and second is the name of the field to check.

open(FILE,”<amit”)|| die “Cannot open file amit for input”;

for $line (<FILE>)

{

my $col = 0;

chomp ($line);

($frame,$field)=split(/,/,$line);

$procedure = “Objective: Verify the frame $framen”;

$procedure .= “Procedure:n”;

$procedure .= “1. Go to frame $framen”;

$result = “1. Verify that the frame ($frame)is displayed correctly.n”;

$result .= “2. Verify that $field is displayed in $frame”;

$worksheet->write($row++,$col,”Verify the frame $frame”);

$worksheet->write($row,$col++,$procedure);

$worksheet->write($row++,$col,$result);

}

close (FILE);

$workbook->close();

exit;

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • blogmarks
  • Blogosphere News
  • co.mments
  • HelloTxt
  • Ping.fm
  • Reddit
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Add to favorites
  • BlinkList
  • Diigo
  • email
  • Identi.ca
  • LinkedIn
  • Live
  • MyShare
  • MySpace
  • PDF
  • SheToldMe
  • Slashdot
  • Socialogs
  • Tumblr

related post

CBA0E3ABEB1A7038A3FD2A47BA03BC1B Perl Excel to create a test plan with perl    specially very

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One comment

  1. Amit Agarwal

    September 14th, 2009 at 10:34 PM

    test comment

Leave a reply
profile

Back to top

report
guidelines