in reply to placing an existing line from my XML file to the top of the file

I'm assuming that's only part of the file and you may have multiple testsuite elements. I don't understand the example though as I would have expected the testsuite time and counts to be the sum the testcases.

#!perl use strict; use XML::Twig; my $t = XML::Twig->new( twig_handlers => { 'testcase' => \&testcase, 'testsuite' => \&testsuite, }, pretty_print => 'indented',); $t->parsefile( 'test.xml' ); $t->print_to_file('new.xml'); $t->print(); my @case=(); sub testcase { my ($t,$e) = @_; push @case,$e->cut; }; sub testsuite { my ($t,$e) = @_; while ($_ = pop @case){ $_->paste($e); } };
poj
  • Comment on Re: placing an existing line from my XML file to the top of the file
  • Download Code

Replies are listed 'Best First'.
Re^2: placing an existing line from my XML file to the top of the file
by gasjunkie_jabz (Novice) on Aug 20, 2015 at 19:00 UTC

    Thanks Poj, that is correct. This is only one part of the Testsuite. Our system will contain multiple testsuites for each group of testcases. for instance, in the example I posted, it's the "combination" Testsuite which contain 20+ testcases. I've truncated the spreadsheet so that it only ran 5 testcases for the purpose of this thread. Every XML file will need to have this format in order for our test Metrics to be uploaded.