Home > ColdFusion, Linux > CF form validation, Unix search + replace and JMeter load-testing

CF form validation, Unix search + replace and JMeter load-testing

I’ve recently been doing some form validation using CF and needed to valid some form fields. One of the form fields was a uuid so was wondering how to check if it was in the correct format. CF’s isValid(’uuid’,form.uuid) did the trick nicely and can be used for a whole bunch of other data-types – array, binary, boolean, credit card, date, email, float, guid, integer, query, string, struct, telephone, url or uuid. So as you can see its a very handy function for validating form variables.

I was looking at ways to replace a bunch of strings in a SQL file and came across a unix command sed which can be used to do the job. Using the -e command allows you to replace multiple strings within a file and I then piped the result into a different SQL file.

    sed -e “s/string1ToFind\string2Replacement/g” -e “s/stiring2ToFind/string2Replacement/g” -e “string3ToFind/string3Replacement/g” sqlFile1.sql > newSqlFile1.sql 

I’ve also been using JMeter from Apache recently to perform some load tests on a website.
I got the binary here: http://jakarta.apache.org/site/downloads/downloads_jmeter.cgi Just unzip it and run /bin/jmeter and it will load up.

In test plan create a thread group (edit->add->thread group) and there you can set the number of users/threads, loop count and a couple of other things. Select thread group and add a http request(edit->add->sampler->http request). There you can set the webserver name and the rel path from the web-server, add paramters to post(i,.e. mimic a form post) and retreive all embedded resources(if you want to test getting the webpage resources too along with the request). Again you can change stuff like following redirects and other bits and pieces.

You can add a whole bunch of Listeners or reporting graphs/charts. Just select the thread group again and edit->add->listener and add summary report and view reports in tree. The summary report gives you #samples,average,min,max, deviation, errors, throughput, kb/sec and avg bytes while the view reports in tree lets you see what is reqeusted and returned as part of the http request. I’ve not checked out other reports, I’m sure they contain lots of handy stuff.

Categories: ColdFusion, Linux Tags:
  1. No comments yet.
  1. No trackbacks yet.

Anti-Spam Protection by WP-SpamFree