#!/usr/bin/perl use UserScenarioDesc; #providing web_link and user_scenario_name for testing the working of the script my $web_link="http://lcla238.ping.com/nightly_results/2010_03_23/log_lcla133.ping.com_64___TestSuiteDARE_Tx_Debug_MpaaPseudoIBM_AIX__3_37.html"; my $us_name="testdare/UserScenarioDAREenableDisableEncryptionTx"; #print statement wrote to check the bug print"hello\n"; #calling the user sceanrio description function for testing my $user_scenario_desc = UserScenarioDesc::get_user_scenario_desc($web_link,$us_name); #print statement wrote to check the bug print"Hello\n"; print "UserScenario Description is as follows:\n"; print $user_scenario_desc."\n"; #### package UserScenarioDesc; use strict; use Cwd qw( abs_path ); my ($cwd, $above, $below, $tinc); BEGIN { $cwd = abs_path "."; ($above, $below) = $cwd =~ m~^(.+)/pp2dev/src(/.+|)$~ or die "Not in a pp2dev source tree\n"; my $tinc = "$above/pp2dev/src/testsuite/user/tinc"; my $Common="$above/pp2dev/src/testsuite/user"; unshift @INC, $tinc; unshift @INC, $Common; } use DHPL::System; use nightly::common; use Logs::LogReader; #Defining function BEGIN { use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw( &get_user_scenario_desc ); } sub get_user_scenario_desc{ my($web_link, $us_name) = @_; # constructing web link to open the remote log file if($web_link =~ m/nightly_results(.*?)(.html)/) { $web_link= "/nightly_results".$1.".html"; } #remote copy command `rcp lcla238.ping.com:$web_link /tmp/nightly_db_scenarios.html`; my $file = "/tmp/nightly_db_scenarios.html"; #Generating SUiteLog object my $sul = SuiteLog->new( { FILE => $file } ); # $logfile is the log file of test run #parsing all the log. $sul->parse_suite( ); # get_scheduled will return the list of all the test_suites present in the respective test_run foreach my $sname ( @{$sul->get_scheduled( )} ) { #creating scenario_log variable using SuiteLog object my $scl = $sul->get_log( $sname ); #invoking method to list all the scenarios names for the given web link. my $name = $scl->name( ); ##invoking method to extract the description (if any) for the given scenario name of the provided test_web_link. my $description=$scl->get_decription(); if($name eq $us_name){ return $description; } } } 1; #### hello (234113)Hello UserScenario Description is as follows: Steps for testing basic encryption: 1) turn on encryption on a device and verify 2) copy test data file to device 3) copy data from device to output file 4) verify test data file and output file are the same 5) reboot 6) verify device is still encrypted 7) copy data from device to output file again 8) verify test data file and output file are still the same 9) turn off encryption and verify 10) copy data from device to output file 11) verify test data file and output file are not the same