Pretender

Test links to web sites that aren't there.

I made this tool for a friend who's a freelance graphic designer. She was building a web page for a client that had links to other pages on their company's private network, so she couldn't test them, right?

Run Pretender with the list of URLs that the client has sent you and you can test by clicking around on your web page. Run this on your Mac or Linux machine and you can pretend to serve any web pages you want.

This would also work well for testing a set of web pages together that will be published to different domains and have links to each other.

Download and Install

Download the zip file for Pretender by clicking here. Unzip it wherever you'd like. Add the URLs for the pages you need to fake to the "urls.txt" file. When Pretender runs, those URLs will work. But other URLs for those domains will fail.
Using Terminal.app to run Pretender

Run

Open the Terminal application and run the "pretender" command. Now open the web site you're building in your web browser and try out the links. When you're done, just close the Terminal window or exit Pretender via Control-C.

Pretender needs you to enter your password for the "sudo" command so that it can change the /etc/hosts file temporarily and run a web server on port 80, the usual HTTP port.
Correct links are Green

Are you a good link?

Links that you've set up correctly will take you to a green page.
Failed links are Red

Or a bad link?

Links that are incorrect will show you the problem in red.
In Preferences.app, make sure web sharing is turned off

Troubleshooting

If it fails with messages like these,
Exception in thread "main"
java.net.BindException:
Address already in use
then you probably need to make sure that "Web Sharing" is turned off. Open the Mac Preferences and go to the Sharing page. Then uncheck the box next to "Web Sharing" and try again.

Sample Session

$ cat urls.txt
#
# List the URLs to pretend to serve here.
#
# http://host/path Some optional description of the page.
#

http://conhugeco.com/foo ConHugeCo Foo
http://conhugeco.com/bar ConHugeCo Bar
http://conhugeco.com/no/comment

$ ./pretender
Routing conhugeco.com to localhost
Found rule: ValidRequest(conhugeco.com, /foo, ConHugeCo Foo)
Found rule: ValidRequest(conhugeco.com, /bar, ConHugeCo Bar)
Found rule: ValidRequest(conhugeco.com, /no/comment, )
2010-10-13 01:07:41.363::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
2010-10-13 01:07:41.441::INFO:  jetty-6.1.12rc1
2010-10-13 01:07:41.504::INFO:  Started SocketConnector@0.0.0.0:80
Request matched ValidRequest(conhugeco.com, /no/comment, )
Request matched ValidRequest(conhugeco.com, /no/comment, )
Request matched ValidRequest(conhugeco.com, /no/comment, )
^C
Restored /etc/hosts file to original state.
$
Picture of my email address.