Get test cases' title

上一篇 / 下一篇  2008-11-12 10:33:44 / 个人分类:Perl

测试工作中文本处理是一项非常繁琐的事情,利用Perl可以事半功倍。下面的代码将从杂乱的文本文件tcs.TXT中提取测试用例名称,并保存到testcase.txt。详见附件。

use warnings;
my $filename = "tcs.TXT";
my $exportFile = "testcase.txt";
open FILE, $filename
 or die "Can't open $filename: $!";
open TC, ">$exportFile"
 or die "Can't create $exportFile: $!";

while(<FILE>){
 chomp;
 if (/TEST CASE: (.*)     /){
  chomp ($1);
  print TC $1;
 }
 if (/DEVICE UNDER TEST: (.*)\s+/){
  chomp ($1);
  print TC "_$1\n";
 }
}


TAG: testcase Perl title

 

评分:0

我来说两句

日历

« 2024-04-30  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 47860
  • 日志数: 80
  • 建立时间: 2008-10-27
  • 更新时间: 2009-07-17

RSS订阅

Open Toolbar