[Webtest] Unique Directory for reports not possible?

Troy McGuire webtest@lists.canoo.com
Sat, 08 Jul 2006 15:39:24 -0700


What I had before, where each test would over-write the previous report, 
was the the following directory structure.  Note, the "canoo_webtest" 
directory is not the one in /usr/local/sbin, it's in a "qa" folder where 
each folder holds the scripts for the tool being used - WebTest in this 
case):

/usr/local/www/customer.com/qa/canoo_webtest/
     -main buildfile, various webtest scripts, keystores, etc-
     webtest-results/
          results.html
          results.xml
          report.css
          showHide.js
          images/
               collapseall.png
               expandall.png
               less.gif
               logo.gif
               more.gif
               ok.gif
               optional.gif
               todo.gif

I remember when I first wrote this script I tried having the 
"results.html" save as "index.html" instead, but then no file was 
created.  I think what I am experiencing now is related somehow.  With 
my current script, I have the following directory structure:
/usr/local/www/customer.com/qa/canoo_webtest/
     -main buildfile, various webtest scripts, keystores, etc-
     webtest-results/
          results.xml
          2006-07-08_15-28-08/
               report.css
               showHide.js
               images/
                    collapseall.png
                    expandall.png
                    less.gif
                    logo.gif
                    more.gif
                    ok.gif
                    optional.gif
                    todo.gif

After Mittie's and Denis' comments/suggestions, I changed my script a 
bit, but nothing has changed (in terms of having a 'results.html' show 
up anywhere, and I'm not sure what's going on with the 'results.xml' 
file being where it is).  I did look in WebTestReport.xsl, but didn't 
see anything obvious, not that I'm guru enough to completely understand 
it; but it appears okay.  Here is my current script, not sure if my 
changes made it better, worse, or are benign.  Any further assistance 
will be greatly appreciated.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project SYSTEM 
"/usr/local/sbin/canoo_webtest/selftests/config/WebTest.dtd">

<project name="All Tests" basedir="." default="testSuite">
    <tstamp>
        <format property="timestamp" pattern="yyyy-MM-dd_HH-mm-ss" />
    </tstamp>
    <property name="webtest.home" 
location="/usr/local/sbin/canoo_webtest" />
    <property name="test.dir" 
location="/usr/local/www/customeradvertising.com/qa/canoo_webtest" />
    <property name="test.file" value="mybuild_02.xml" />
    <property name="webtest.resultpath" 
value="${test.dir}/webtest-results/${timestamp}"/>
    <property name="webtest.resultfile" value="results.xml"/>
    <property name="webtest.resultfile.html" 
value="${webtest.resultpath}/results.html"/>
    <import file="${webtest.home}/lib/taskdef.xml" />
   
    <target name="init" description="Checks that needed properties are 
defined">
        <fail message="test.file should be set" unless="test.file" />
        <fail message="test.dir should be set" unless="test.dir" />
    </target>
   
    <target name="testSuite" depends="init" description="Runs the Test 
Suite">
        <mkdir dir="${webtest.resultpath}" />
        <!-- <antcall target="cleanUp" />    -->
        <antcall target="test.suite" />
        <antcall target="formatResults" />
    </target>
   
<!--    <target name="cleanUp" description="Deletes all generated files" 
unless="webtest.skipCleanup">
        <delete>
            <fileset dir="${webtest.resultpath}" includes="**/*.*ml" />
        </delete>
    </target>
-->   
    <target name="formatResults" description="Formats the XML result 
file using XSL">
        <tstamp>
            <format property="report.time" pattern="dd.MM.yyyy HH:mm" 
locale="us" />
        </tstamp>
        <property name="resources.dir" value="${webtest.home}/resources"/>
        <style
                basedir="${resources.dir}"
                destdir="${webtest.resultpath}"
                includes="${webtest.resultpath}/${webtest.resultfile}"
                force="true"
                extension=".html"
                style="${resources.dir}/WebTestReport.xsl">
            <param name="reporttime" expression="${report.time}"/>
            <param name="title" expression="${ant.project.name}"/>
        </style>
        <!-- copy resources needed by the html page to the same dir: the 
report must be ok too when opened from filesystem (without webserver) -->
        <copy todir="${webtest.resultpath}">
            <fileset dir="${resources.dir}">
                <include name="report.css"/>
                <include name="showHide.js"/>
                <include name="images/*.*"/>
                <include name="results.html"/>
            </fileset>
        </copy>       
        <echo message="Webtest result overview available in 
${webtest.resultfile.html}"/>
    </target>

    <target name="test.suite">
        <ant antfile="sa_loginpage_02.xml"/>
        <ant antfile="sa_login_02.xml"/>
    </target>
</project>

Thank You,

Troy
troy at spawn or die dot com

Denis N. Antonioli wrote:
> Hi Toy
>
> I had this working on my previous project (2 month ago...), so it is 
> definitely possible.
>
> If I understand you correctly, webtest reacts correctly and writes in 
> a timestamp-named directory its result.xml and all the server 
> responses, but the result.html is missing?
> If so, the only place the path may be hardcoded is in 
> WebTestReport.xsl...
>
> Happy testing
>     dna
>
> On 7 juil. 06, at 02:01, Troy McGuire wrote:
>
>> So I finally figured out how to make a suite of tests run and have 
>> everything reported in HTML.  Today I decided to make WebTest create 
>> a directory for the results based on the timestamp from when the test 
>> was run.  It does create a directory named after the timestamp with 
>> everything except the "results.html" file.  I even added <include 
>> name="results.html"/> to a portion of my script, but same results.  
>> Does anyone know what's going on here?  It seems like something in 
>> the background is hard-coded.  Do I have to have my previous report 
>> over-written by the current one every time I run a test?  Below is my 
>> script.
>>
>> Thank You,
>>
>> Troy
>> troy at spawn or die dot com
>> ---------------------------------------------------------------------------------------------- 
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE project SYSTEM 
>> "/usr/local/sbin/canoo_webtest/selftests/config/WebTest.dtd">
>>
>> <project name="All Tests" basedir="." default="testSuite">
>>    <tstamp>
>>        <format property="timestamp" pattern="yyyy-MM-dd_HH-mm-ss" />
>>    </tstamp>
>>    <property name="webtest.home" 
>> location="/usr/local/sbin/canoo_webtest" />
>>    <property name="test.dir" 
>> location="/usr/local/www/customer.com/qa/canoo_webtest" />
>>    <property name="test.file" value="mybuild_02.xml" />
>>    <property name="webtest.resultpath" 
>> value="${test.dir}/webtest-results/${timestamp}"/>
>>    <property name="webtest.resultfile" value="results.xml"/>
>>    <property name="webtest.resultfile.html" 
>> value="${webtest.resultpath}/results.html"/>
>>    <import file="${webtest.home}/lib/taskdef.xml" />
>>      <target name="init" description="Checks that needed properties 
>> are defined">
>>        <fail message="test.file should be set" unless="test.file" />
>>        <fail message="test.dir should be set" unless="test.dir" />
>>    </target>
>>      <target name="testSuite" depends="init" description="Runs the 
>> Test Suite">
>>        <mkdir dir="${webtest.resultpath}" />
>>        <antcall target="cleanUp" />
>>        <antcall target="test.suite" />
>>        <antcall target="formatResults" />
>>    </target>
>>      <target name="cleanUp" description="Deletes all generated files" 
>> unless="webtest.skipCleanup">
>>        <delete>
>>            <fileset dir="${webtest.resultpath}" includes="**/*.*ml" />
>>        </delete>
>>    </target>
>>      <target name="formatResults" description="Formats the XML result 
>> file using XSL">
>>        <tstamp>
>>            <format property="report.time" pattern="dd.MM.yyyy HH:mm" 
>> locale="us" />
>>        </tstamp>
>>        <property name="resources.dir" 
>> value="${webtest.home}/resources"/>
>>        <style
>>                basedir="${webtest.resultpath}"
>>                destdir="${webtest.resultpath}"
>>                includes="${webtest.resultfile}"
>>                force="true"
>>                extension=".html"
>>                style="${resources.dir}/WebTestReport.xsl">
>>            <param name="reporttime" expression="${report.time}"/>
>>            <param name="title" expression="${ant.project.name}"/>
>>        </style>
>>        <!-- copy resources needed by the html page to the same dir: 
>> the report must be ok too when opened from filesystem (without 
>> webserver) -->
>>        <copy todir="${webtest.resultpath}">
>>            <fileset dir="${resources.dir}">
>>                <include name="report.css"/>
>>                <include name="showHide.js"/>
>>                <include name="images/*.*"/>
>>                <include name="results.html"/>
>>            </fileset>
>>        </copy>              <echo message="Webtest result overview 
>> available in ${webtest.resultfile.html}"/>
>>    </target>
>>
>>    <target name="test.suite">
>>        <ant antfile="customer_loginpage_02.xml"/>
>>        <ant antfile="customer_login_02.xml"/>
>>    </target>
>> </project>
>> _______________________________________________
>> WebTest mailing list
>> WebTest@lists.canoo.com
>> http://lists.canoo.com/mailman/listinfo/webtest
>
> --A vacuum is a hell of a lot better than some of the stuff that nature
> replaces it with.
>   -- Tennessee Williams
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>
>