Try placing the <copy> after the file is created. I had it after the
<copy> in your original ant file. As a minimum it has to be after
the <style> task as that is where the file is created.

Troy McGuire wrote:
Changing the "resultpath" in the configs of my test scripts moved the 'results.xml' to the right spot, but after adding the "copy tofile=..." I get:

Warning: Could not find file /usr/local/www/lgeadvertising.com/qa/canoo_webtest/webtest-results/2006-07-08_20-05-01/results.html to copy. Maybe it still does not exist? I tried upgrading to R_1357, but then the build failed for completely different reasons ( *see below ), so I downgraded as I don't need additional problems at this point (unless I'm chasing down a known bug that's been fixed!). Anyone know why this is happening?


Thank You,

Troy McGuire

* The message I got after unzipping build.zip for R_1357 was:
java.lang.NoSuchMethodError: com.gargoylesoftware.htmlunit.html.HtmlInput.setValueAttribute(Ljava/lang/String;)Lcom/gargoylesoftware/htmlunit/Page;


Paul King wrote:

Your file worked for me (replacing the actual test steps)
as long as I changed the config element to point to your
timestamped properties:

   <config
       summary="true"
       saveresponse="true"
       resultpath="${webtest.resultpath}"
       resultfile="${webtest.resultfile}" .../>

To get an index.html (no need to have results.html in previous copy):

<copy tofile="${webtest.resultpath}/index.html" file="${webtest.resultpath}/results.html"/>

Cheers, Paul.


Troy McGuire wrote:
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
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to