[Pdx-pm] short job
Chris Dawson
cdawson at webiphany.com
Fri Apr 23 19:09:53 CDT 2004
Hi there,
I have need for someone who can write a small program for me. I am not
sure how to agree to payment, so I will just describe the job first. I
am happy to pay by the hour, or I would be happy if someone wanted to
propose a complete solution for a fixed price. I would like to see some
work samples, of course.
Here is what I want:
I need a test script which:
-- receives a hostname or IP from the command line
-- read in XML files
-- each XML file specifes a request to a webserver
-- the XML contains a URL and a method, GET or POST should be fine for now
-- the XML will provide a mechanism to POST variables, and can also POST
files, by referencing a path on the same machine.
-- verifies that output from the URL matches a regexp once the request
has processed
-- can chain output from one request and use as input to the next
request by a regexp (1)
-- the XML will provide a way to run pre-processing and post-processing
scripts (probably perl scripts) before/after each URL access (2)
-- the output of each pre-process script will be passed along with the
output from accessing the URL, to the post-processing script (3)
-- each stage will be fully logged
-- might want to pay for writing some XML files as well
Here is an example of the command line:
./test_server.pl 192.168.1.10
Here is a simple XML:
<test>
<urilist>
<uri>
<location>/process.html</location>
<variable name="foo">Hello</variable>
<variable type="file" name="foo_file">/home/cdawson/test.txt</variable>
<ouput_match><!-- This is an example of #1 -->
<regexp>abc(.{3})(.{17})xyz</regexp><!-- This might need to be CDATA? -->
<variable name="foo"/>
<variable name="bar"/>
</output_match>
</uri>
<uri>
<pre_process path="./scripts/second-pre.pl" variable="foo"/>
<location>/second.html?foo2=$bar</location>
<variable type="interpolated" name="foo"/>
<post_process path="./scripts/second.pl" variable="bar" /><!-- This is
an example of #2 -->
</uri>
</urilist>
</test>
To explain the XML file: First, the test_server.pl accesses the URL
http://192.168.1.10/process.html. It posts to the URL the variable
"foo" with value "Hello" It also posts the file named
"/home/cdawson/test.txt" The output of accessing this URL is sent to
the "output_match" filter. Let's pretend that the output is
abdefg...xyz (all 26 letters). The first grouping match would be set to
the variable $foo. The second would be set to $bar. So, $foo would
equal "def" and bar would be "ghi...w" (18 letters). This is completely
arbitrary for this example, of course. Then, after accessing this URL,
the test script runs the "./scripts/second-pre.pl" script, with the
environment variable "TEST_VAR_foo" set to "def". I think this is a
simple way to pass variables which the second-pre.pl script can
process. Then, the script accesses the URL
"http://192.168.1.10/second.html?foo2=def" Notice that it used the $foo
variable and interpolated the value of it in the URL as a GET request.
Then, the output of the preprocessing script, the output of the request
itself are both passed as environment variables (using the keys
"TEST_preprocess_output" and "TEST_request_output"), in addition to the
variable bar passed as "TEST_VAR_bar" with the "ghi...w" value.
There are probably some holes in what I am suggesting, so I am open to
reworking the XML, changing requirements etc.
My design requirements:
-- the test_server.pl script should run under -w and strict
-- everything should reside inside a .pm, so test_server.pl is basically
a wrapper. I think this makes it easier to unit test the
subroutines/functions.
-- use variables named "test_variable" not "testVariable" or
"strTestVariable" (absolutely don't want hungarian notation!)
-- perfectly happy to use any perl modules from CPAN. If you can figure
out a way to do this with ten lines wrapping around an existing perl
module, I'd be happy to pay you for this.
-- If someone is more comfortable doing this in python or ruby to have
the solution done in a different language, I am happy with either of
these two languages, if there are some lurkers on this list.
Anyone want to tackle this?
Chris
More information about the Pdx-pm-list
mailing list