vasuperl has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have 10 testcases. I need to redirect the name of the testcase and also the output i.e.,(PASS/FAIL) of those test cases to a table format in either HTML or XML using the perl script. I am a beginner of perl. Any help or idea would be appreciated. Thanks in advance.

  • Comment on How to redirect the output to a table in HTML/XML

Replies are listed 'Best First'.
Re: How to redirect the output to a table in HTML/XML
by Anonymous Monk on Jan 23, 2015 at 08:32 UTC

    How is this question different from when you asked three weeks ago? What code have you written in the meantime? Please see How do I post a question effectively? and show some effort, since this is (usually) not a code writing service.

    Anyway, several recommendations for modules to handle XML are given e.g. here or here, however, I have to strongly recommend against using XML::Simple (reasons are given in that second link).

Re: How to redirect the output to a table in HTML/XML
by vinoth.ree (Monsignor) on Jan 23, 2015 at 05:38 UTC
    Hi vasuperl,

    What have you tried so for ?

    Please give us more informations like, how you are executing your test cases and the sample output formats?

    Lets say, if you have your output in a text file you can use awk/sed command to fomat the output into HTML table format.

    For example,
    Testcase status testcase1 pass testcase2 fail testcase3 pass
    awk 'BEGIN {print "<table>"} {print "<tr>"; for(i = 1; i <= NF; i++ +) print "<td>" $i "</td>"; print "</tr>"} END {print "</table>"}' output.txt > final_output.html

    All is well