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_1704
Posted: 06-May-2008 10:12

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

WebTest 2.6 released, featuring upgrades to Ant 1.7, Groovy 1.5.4, and HtmlUnit 1.14.
The release includes support for data-driven testing, testing of drag-and-drop, advanced AJAX support, high-concurrency testing and reporting, real-time monitoring, and - as usual - lots of handling improvements.
Posted: 18 March 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