23.03.2013 Views

Agile Performance Testing - Testing Experience

Agile Performance Testing - Testing Experience

Agile Performance Testing - Testing Experience

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

folder). Thus, every time an application tried to communicate<br />

with a remote server, it was actually directed to the test<br />

environment in which we could control the answers it was<br />

getting.<br />

3. On the test server we created an index.php file, which redirected<br />

all communications to the path where the output of<br />

our ‘real-world creation machine’ was. After client data was<br />

redirected to our testing environment, it passed through a<br />

set of PHP filters & parsers (see sample below), which separated<br />

data parameters for manipulation – and which retur-<br />

<br />

www.testingexperience.com<br />

#Handle submitted forms:<br />

if(isset($_POST[“baseString”])){<br />

$string=$_POST[“baseString”];<br />

$i=0;<br />

while(isset($_POST[“value$i”])){<br />

$string.=$_POST[“value$i”];<br />

if(isset($_POST[“value”.($i+1)]))<br />

$string.=”|”;<br />

$i++;<br />

}<br />

$string.=’~’;<br />

$handler = fopen(“data\DataQuery.$Content$Date.$Number”,”w”);<br />

fwrite($handler,$string);<br />

fclose($handler);<br />

#if the original Response was updated<br />

elseif(isset($_POST[“original”])){<br />

$handler = fopen($_POST[“orgFile”],”w”);<br />

fwrite($handler,$_POST[“original”]);<br />

fclose($handler);<br />

$message = “The fields were updated with the original response”;<br />

}<br />

else{<br />

$orgFile=’originalResponse.txt’;<br />

$testerName=”default”;<br />

$message = “”;<br />

}<br />

#Dislpay the forms:<br />

ned answers according to the tester-configured ‘real- world’<br />

answers.<br />

index.php Redirection Sample:<br />

The index.php routed the device to the test environment for<br />

data manipulation and returning of the tester-controlled<br />

‘real-world’ mimicking data.<br />

Using the above data-routing scheme and ‘real-world machine’,<br />

allowed the testing team to configure the test environment<br />

based on testing needs and enabled to cover a wider<br />

range of ‘real-world’ situations. This increased both the test<br />

coverage & product maturity. 4<br />

4 Thanks to Mr. Uri Mor for his contribution to this section of the<br />

article, for the PHP code example and for his professional partnership.<br />

### Short Format<br />

echo “Short Format”;<br />

$lines = file(‘queryBody.txt’);<br />

$i=0;<br />

echo “”;<br />

echo “”;<br />

foreach ($lines as $line){<br />

if(!in_array($i,$shortArray)){<br />

echo ‘’.”<br />

\n”;<br />

}<br />

$i++;<br />

}<br />

echo “”;<br />

echo “”;<br />

### Long format<br />

echo “Long Format”;<br />

$lines = file(‘queryBody.txt’);<br />

$i=0;<br />

echo “”;<br />

echo “”;<br />

The Magazine for Professional Testers<br />

11

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!