Topic: Testing a bunch of links with cucumber

Hello all

Before I go about doing this I was wondering if anyone else had a smart way of doing this.

On my pages I have various links (for example, cancel buttons on new user pages, sidebar links, affiliates etc.)

What I would like to do is a quick test of every link which has a get request on each page. Nothing in depth, just a "did the link return an HTTP 200".

Doing a scenario for each link seems rather overkill so I am wondering if anyone has already written a step definition for something like

Given I am on the home page
When I check every link
Then they should all return 200 codes

Or something to that effect.

Last edited by RurouniJones (2010-11-24 02:06:57)

Re: Testing a bunch of links with cucumber

I don't think cucumber would be the proper tool for what you outline.

I wouldn't do scenario for each link as such, but would work them into the behavior you are testing.  Its not as bad as it sounds unless you are backfilling. smile You also shouldn't have to test more global links from every page, just one place, such as a sidebar feature.

Looking for 200s won't necessarily help you - what if you have a stubbed link? Maybe it'll return the home page, instead of the food page. It kicks back a 200, so you think its all jolly. (Not saying that's happened. wink )