Canoo Webtest WebTest Canoo

Core Step verifyLinks

Description

This step checks the validity of all links on the current page. Non-HTML pages (CSS, JavaScript, XML files) are not checked for internal links. Non-HTTP links (mail addresses, ftp etc.) are not checked or followed.

You can use this test recursively, so you can also check the links on the pages, which are linked on the current page and so on. For this reason, you can specify the depth parameter.

To avoid scanning sub-links on other hosts, you can set the onsiteonly parameter. If it is set to "true", only the first link on a foreign host is checked for validity.

Parameters

depth
Required? no, default is 0
The depth parameter defines the depth of the recursive search for broken links on sub-pages.
description
Required? no
The description of this test step.
excludes
Required? no, default is <empty>
If excludes is set then each link found is compared to the defined string (via regexp), if it matches then the link is not followed.
ignoreForeignJSErrors
Required? no, default is false
Indicates if JavaScript errors should be ignored on visited pages from a different host than the current page.
includes
Required? no, default is <all>
If includes is set then each link found is compared to the defined string (via regexp), if it matches then the link is processed, others are ignored.
onsiteonly
Required? no, default is false
If onsiteonly is set to true, the recursive search for invalid links is limited to the local host. Only the initial link to a foreign host is checked, but no deeper search is performed.

Details

Don't forget invoke before verification
<webtest name="Check all links on current page">
  <config ... />
  <steps>
    <invoke ... />
    <verifyLinks description="Check Links"/>
  </steps>
</webtest>
<webtest name="Check all links on current page, on subpages and on their subpages">
  <config ... />
  <steps>
    <invoke ... />
    <verifyLinks description="Check Links
      depth="2"/>
  </steps>
</webtest>
<webtest name="Check all links on current page and on subpages except on foreign hosts">
  <config ... />
  <steps>
    <invoke ... />
    <verifyLinks description="Check Links
      depth="1
      onsiteonly="true"/>
  </steps>
</webtest>

news

Latest build: development
Posted: 19-Jul-2016 17:36

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