Canoo Webtest WebTest Canoo

Available Excel Steps

This is the syntax documentation for the Excel steps.

The Excel Steps allow various tests to be performed on Excel files that may be referenced by your web pages. There are steps which let you verify text content, verify styles used and verify sums as well as a document structure filter which allows you to further manipulate the extracted information.

Simple Usage Example

sampleSimpleUsageExample.xml
<project name="Sample: SimpleExcelTestbasedir=".default="main">

  <import file="${webtest.home}/lib/taskdef.xml"/>

  <target name="main">
    <webtest name="myExcelTest">
      <config
        host="www.myserver.com"
        port="8080"
        protocol="http"
        basepath="myApp"
        saveresponse="true"/>
      <steps>
        <invoke
          description="get overview page"
          url="overview.html" />
        <invoke
          description="get PDF document"
          url="publicData.xls"/>
        <excelVerifyCellValue cell="B2text="Report"/>
        <excelFindRow col="CstartRow="5"
            text="TOTALproperty="totalRow"/>
        <storeProperty property="lastRowvalue="#{totalRow}-1eval="true"/>
        <repeat counterName="row"
                    startCount="5endCount="#{lastRow}">
          <excelVerifyCellStyle cell="D#{row}"
              border="left,bottom:thin,top:dashed"
              borderColor="left:red"/>
          <excelVerifyCellStyle cell="E#{row}"
              type="formula"/>
          <excelVerifyCellValue cell="E#{row}"
              text="/SUM\(.*\)/"/>
        </repeat>
      </steps>
    </webtest>
  </target>
</project>

Additional Setup Information

You have three ways to incorporate the Excel steps into your tests:

Import all steps approach:
Simply use <import file="${webtest.home}/lib/taskdef.xml"/> as illustrated in the Samples.
Specific plugins approach:
You can explicitly define the base and Excel tasks: <taskdef resource="webtest_base_strict.taskdef" classpathref="webtest.all" loaderref="webtest.loader"/> <taskdef resource="webtest_exceltest_relaxed.taskdef" classpathref="webtest.all" loaderref="webtest.loader"/>
Antlib approach:
You can use namespaces as follows: <target xmlns:exceltest="antlib:com.canoo.webtest.plugins.exceltest" name="main"> then simply refer to the steps using the namespace you defined, exceltest in this case, e.g. <exceltest:verifyCellValue cell="A1" text="Test"/> <exceltest:verifyCellFormat cell="B3" borderColor="red"/> Note that the excel prefix is stripped off any tasks starting with excel.

news

Latest build: R_1823
Posted: 20-Feb-2013 12:26

WebTest 3.0 released, featuring upgrades to Java 5, Groovy 1.6, and HtmlUnit 2.4.
The release includes support for maven integration, IDE-integration like for unit tests, capturing of background JavaScript errors, new steps for mouseOver and mouseOut events, better parallel execution of tests and - as usual - lots of handling improvements.
Posted: 5 March 2009

WebTest @ JavaOne
Dierk König presented "Functional testing of web applications: scaling with Java" on Wed May 7, 13:30 at JavaOne 2008 in the Tools and Scripting Languages track.
Posted: 8 May 2008

New WebTest screencast available:
Data Driven WebTest
Posted: 13 November 2007

First WebTest screencast available:
Creating a first Webtest Project

Extend WebTest with Groovy! Groovy in Action is available in every good bookstore.
Groovy in Action
Posted: 29 January 2007