A simple Ruby webserver for your testing infrastructure

On occasion, I run into the need to host some files on a web server to perform some testing. Whether it’s testing an embedded solution on smart, multi-function printers, serving files for mobile testing or facilitating some piece of automation, it’s nice to have a throw away web server when you need it.

Several scripting languages can pull this off, but since I’m partial to Ruby, I thought I’d offer up the Ruby flavored one-liner I use on occasion. I find this useful as it’s easy to just whip out on a command line any time I need it or fold it into more complex workflows.

Just type this in at the command line, assuming you have Ruby installed, and you’ll have a simple little file server up and running in seconds:

ruby -run -e httpd . -p 5000

Just a quick breakdown on what we’ve done here:

ruby -run -e
httpd .
-p 5000

To kill it, a simple CTRL + c will end your process.

I have a log hoarder version I’ll share later.

 
1
Kudos
 
1
Kudos

Now read this

Is Exploratory Testing Just ‘Playing Around’

Take a moment to think about the importance of language as a tester, especially under the heavy shadows of larger business entities. It’s a topic often discussed in software testing circles when it comes to testing and for good reason.... Continue →