Validating a link checker test

113 Views Asked by At

My group uses Jenkins to deploy our code, and I've started adding tests in Jenkins to validate our code.

In the case of a website we build and deploy, I've downloaded linkchecker.exe to my Jenkins slave and I will implement this test as another Jenkins job once I am happy it is doing what I want it to do...

The link checker in question is from here

http://wummel.github.io/linkchecker/

If I run the link checker against the real url it passes...huzzah!

If I point the link checker against a bogus url it fails...huzzah!

But the actual use case I want to validate is if a subpage within the site fails to load...and I am stumped as to how to do this.

We build the website from a VS c# project and I've mucked around with it a bit but to this point I haven't caused a failure of the type I am looking for and honestly I would rather not muck with the site itself for this one case where I am trying to prove a failure condition.

So the long and the short of it:

Presuming I have full control over a client and a server, how can I make one or more subpages from a website on the server fail to load correctly on the client?

Thanks!

1

There are 1 best solutions below

1
On

Do all the links point to the same host? If not you can override DNS and point to a bogus host in the client's c:\Windows\System32\Drivers\Etc\hosts file (if you are on windows) or /etc/hosts (on a Linux variant).