Performance Testing with Apdex

Often when performance testing in a black box environment, you are left with the onerous responsibility to report against response time performance.

A typical approach by performance testers is to rely on 95th percentiles, which is effectively a Service Level Agreement (SLA) saying that 95 percent of all my samples have a response time below 5 seconds. This is often specified as a Non Functional Requirement (NFR).

But so what? What does this really tell us? More importantly, if the SLA fails, you’re probably left hanging in the wind trying to explain how “bad” it failed to a (now interested) Project Manager. On the flip side, if everything is green, how close were you to failing? Are you an n’th degree away from failing? What about comparing two different application’s response time performance when they have different NFRs to begin with? Getting confused?

Enter the Apdex performance index. Apdex is a numerical measure of user satisfaction that can be built from metrics expressed via more traditional SLAs and/or NFRs. The fundamental objective of Apdex is to simplify the reporting of application response time measurements by making it possible to represent any such measurement using a common metric. This can be reported on by extracting data from Load Runner / JMeter and analysing within Excel as demonstrated below.
apdex_2007

Read on to find out more about these scores and how they are calculated.

Read More

Q. How do I enter the current date or time into a textfield?

A. Use the Time.now method …
Example html:

<html>
   <body>
      <form method="post" action="">
         <textarea name="comments" cols="40" rows="1">
            Enter your comments here...
         </textarea><br />
         <input type="submit" value="Submit" />
      </form>
   </body>
</html>

Example watir:

t=Time.now
@b.text_field(:name,"comments").set(t.strftime("%m/%d/%Y_%H%:M%"))
Read More

Q. How do I get the text displayed in a javascript popup?

A. Use the WIN32OLE extension library with the autoit function library …
You will need to install autoit. You can download it here, once installed you can call the function library using the win32OLE extension library.
Example html:

<html>
   <head>
   <script language="javascript">
      function msgbox (textstring) {
      alert (textstring) }
   </script>
   </head>
   <body id="test_00test_0107" onload="">
      <form>
         <input name="text1" type=text>
         <input name="submit" type=button value="show me" onclick="msgbox(form.text1.value)">
     </form>
  </body>
</html>

Example watir:

require 'watir'
require 'rubygems'
require 'win32ole'
autoit = WIN32OLE.new('AutoItX3.Control')
@b.goto('http://justaddwatir.com/watir/test_html/tc_0101_0200/test_0107.html')
@b.text_field(:name,"text1").set("This is the text in the popup")
@b.button(:name,"submit").click_no_wait
autoit.WinWaitActive("[Class:#32770]")
text = autoit.ControlGetText("[Class:#32770]", "", "Static2")
autoit.ControlClick("[Class:#32770]","","Button1")
puts text

In order for the autoit function to execute, you need to use the .click_no_wait method in watir before the autoit function. This is because once the pop up is presented, the focus comes off the IE window and the script will pause. The .click_no_wait tells the script to continue running regardless of what happens next.
You may use the autoit window identifier to get the properties of the pop up the static text.

Read More

Q. How do I attach to a current IE session?

A. Use the .attach method…
Example watir:

@b=Watir::IE.attach(:title,//)

I have used regex here for the window title, you can be more specific if you like.

Read More

Q. How do I deal with javascript popup's?

A. Invoke the autoit function library with the .click_no_wait method…
You will need to install autoit. You can download it here, once installed you can call the function library using the win32OLE extension library.
Example html:

<html>
   <head>
   <script language="javascript">
      function msgbox (textstring) {
      alert (textstring) }
   </script>
   </head>
   <body id="test_00test_0107" onload="">
      <form>
         <input name="text1" type=text>
         <input name="submit" type=button value="show me" onclick="msgbox(form.text1.value)">
     </form>
  </body>
</html>

Example watir:

require 'watir'
require 'rubygems'
require 'win32ole'
 
autoit = WIN32OLE.new('AutoItX3.Control')
@b.goto('http://justaddwatir.com/watir/test_html/tc_0101_0200/test_0107.html')
@b.text_field(:name,"text1").set("Justaddwatir")
@b.button(:name,"submit").click_no_wait
autoit.WinWaitActive("[Class:#32770]")
result =autoit.ControlClick("[Class:#32770]","","Button1")
puts "successful click =1 unsuccessful =0, the result was "+ result

In order for the autoit function to execute, you need to use the .click_no_wait method in watir before the autoit function. This is because once the pop up is presented, the focus comes off the IE window and the script will pause. The .click_no_wait tells the script to continue running regardless of what happens next.
You may use the autoit window identifier to get the properties of the pop up and the button attributes.

Read More