type into a textfield with keypress event disabled

A colleague asked me how to automate a disabled text-box which has a calendar attached to it. The customer has specified that they want keyboard entries disabled for this text-field, hence every user of the website has to use the calendar drop down.

testfield calendar

Previously, this has been automated by using webdriver to type the text into the text box but as it was disabled, this was impossible.

imagine, this is the html for the textbox:


<input type="text" id="text_box_identifier" value="" disabled >

Using a javascript library such as jQuery, i was able to set this field using


$('#text_box_identifier').attr("value","27/05/2012");

Hope that saves you some time today ….

Posted in Software Testing | Tagged , , , , , , , | 2 Comments

Cucumber unicode support

I ran into a problem today where some french and spanish characters were being displayed strangely.

And this made my test to fail,

After some poking around in google i can across a post that suggested adding

require ‘cucumber/formatter/unicode’

to the env.rb and that seem to have sorted the problems i was having.

Hopes this saves you some time.

Posted in Software Testing | Tagged , , , , , , | Leave a comment

Performance Testing experience using Ant and Jmeter – Part 2

In my last blog post, i described how i have used jmeter-plugins at my current client site, now i am faced with another problem , i need to be able to run these performance test from command line, in other for these performance tests to be executed in a CI environment such as teamcity.

A quick search brings to light the ant jmeter task which is an ant task for running jmeter test. This fulfils a number of the objectives i have set in this first part of this blog post as teamcity has got an inbuilt runner for ant. To install this, you would need to include ant-jmeter-1.1.1.jar in your Ant classpath. See the link for more instructions.

And the author of the ant jmeter tasks has alsop produced an xsl file which can be fed into the xslt ant task to produce a nicely formatted html result page.

I have put all these into an ant script that looks like the below:


<project name="Performance Testing for my project" basedir="." xmlns:ac="antlib:net.sf.antcontrib">
  <taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml">
    <classpath>
    <pathelement location="${basedir}/lib/ant-contrib-1.0b3.jar"/>
  </classpath>
  </taskdef>

  <target name="clean">
    <delete includeemptydirs="true">
      <fileset dir="Results" excludes="**/PerformanceCharts.html"/>
    </delete>
  </target>

  <target name="run-jmeter" depends="clean">
    <taskdef name="jmeter" classpath="${basedir}/jakarta-jmeter-2.5.1/extras/ant-jmeter-1.1.0.jar"
             classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask"/>

    <jmeter
            jmeterhome="${basedir}/jakarta-jmeter-2.5.1"
            resultlog="${basedir}/Results/JMeterResults.xml">
      <testplans dir="${basedir}/TestPlan" includes="*.jmx"/>
      <property name="request.threads" value="300"/>
      <property name="request.loop" value="10"/>
    </jmeter>
  </target>

  <target name="create-reports" depends="run-jmeter">
    <xslt
            in="${basedir}/Results/JMeterResults.xml"
            out="${basedir}/Results/JMeterResults.html"
            style="${basedir}/jakarta-jmeter-2.5.1/extras/jmeter-results-detail-report_21.xsl"/>
  </target>

  <target name="create-graphs" depends="create-reports">
    <ac:for param="reportType" list="TimesVsThreads,ResponseTimesOverTime,ThreadsStateOverTime">
      <sequential>
        <java jar="${basedir}/jakarta-jmeter-2.5.1/lib/ext/CMDRunner.jar" fork="true">
          <arg value="--tool"/>
          <arg value="Reporter"/>
          <arg value="--generate-png"/>
          <arg value="${basedir}/Results/@{reportType}.png"/>
          <arg value="--input-jtl"/>
          <arg value="${basedir}/Results/JMeterResults.xml"/>
          <arg value="--plugin-type"/>
          <arg value="@{reportType}"/>
          <arg value="--width"/>
          <arg value="800"/>
          <arg value="--height"/>
          <arg value="600"/>
        </java>
      </sequential>
    </ac:for>
  </target>

  <target name="main" depends="clean,run-jmeter,create-reports,create-graphs"/>
</project>


I have added an additional target for deleting the test result files as jmeter would append subsequent test results to the previous test results in the file, if file is not deleted.

You would also notice that there is a target named “create-graphs”, this uses the CMDRunner.jar which is a command line utility shipped with jmeter-plugins. This tool has helped me to re-create the graphs which i referred to in part 1 of the blog. It parses the xml result created by the ant jmeter task and creates png images for each of the graphs specified.

This graph images can then be embedded into an html page to be displayed in teamcity.

I hope this helps someone.

Posted in Software Testing | Tagged , , , | 7 Comments

Performance Testing experience using Ant and Jmeter – Part 1

Jmeter is a well known open source performance/load testing tool and to be fair it does a lot of stuff really well.
if you wants to do some quick performance testing without a whole lots of infrastructure around it then it is great.

I started out my task with jmeter with some objectives:

  • A tool that i could integrate into a CI tool such as teamcity
  • Meaningful graphs that could be easily interpreted by any one in the team
  • Able to integrate the graphs into teamcity
  • Able to monitor the performance of the website under test.
  • After doing an initial round of tests, i didnt like the graphs which were being produced by jmeter and i search for plug-ins to enable me plot better graphs.
    I came across jmeter-plugins which is an awesome collection of jmeter plugins. Instructions to install can be found on this page.

    Whilst, there are lots of usefuil graphs bundled within this plugin, i found the following graphs to be most useful

  • Active Thread Over Time
  • Response Times Over Time
  • Response Times versus Thread.
  • I could easily put “Active Thread Over Time” and “Response Times Over Time” to get a complete picture of my performance results solely based on response times.
    And that was good enough for me.

    Also jmeter only allow you to specify a ramp up period and the maximum number of thread you want to execute your tests with. I desperately wanted to be able to specify a ramp down time as well and fortunately, the Ultimate Thread Group which ships with the jmeter-plugins solves that problem for me as well.

    Having jmeter-plugins installed along side with my installation of jmeter helped to get the best out of jmeter, and i was able to specify my load more realistically as well as having clear and better graphs.

    See below.

    Response Time Over Time

    Thread State Over Time

    Time Vs Thread

    In the next blog post i would discuss how i have integrated jmeter with ant, enabling me to run jmeter in command line

    Posted in Software Testing | Tagged , , , , | Leave a comment

    Screenshare tool for my trainings

    Occasionally i invite people round to my house for testing or automation training which sometimes i find inconvenient.
    In other situation, someone on other side of town need my help and i cant.

    I have recently come across the tool – join.me and it is awesome, it allow mwe to share my screen with people and you can give them control ove your machine as well.

    I think this is great !!!!!!

    And guess what it is a free tool, there is a pro-version which is a paid version, but i think the free one satisfy my need. One more tool for my testing and automation coaching.

    Enjoy!!!!!

    Posted in Software Testing | Leave a comment

    Stumbled on Chrome Net Internal

    Sometime i would use my blog as a place to keep interesting stuff for future exploration.

    I came across the chrome net internals today and i think it exposes a lot of useful information that might be useful to testers when testing a web application.

    To access the chrome net internals, navigate to chrome://net-internals/ on a google chrome browser.

    I would be spending some more time in the future exploring this but for now its back to work.

    Enjoy!!!

    Posted in Software Testing | Tagged , , | Leave a comment

    Watir-Webdriver: Website certificate does not come from a trusted source

    A colleague came across this problem while executing our acceptance tests.

    The issue was related to the fact that the SSL certificate for the site was named differently from the domain on which the test were being executed on .

    Hence, we got this error:

    “xxx.xxx.xxxx uses an invalid security certificate.The certificate does not come from a trusted source.The certificate is only valid for <a id=”cert_domain_link” title=”xxx.xxx.com”>xxxx.xxxxx.com</a>The certificate will not be valid until 13-Jul-11 10:28 AM. The current time is 18-Oct-11 10:14 AM
    The page you are trying to view can not be shown because the authenticity of the received data could not be verified.Please contact the web site owners to inform them of this problem.
    Alternatively, use the command found in the help menu to report this broken site.”

    Well the fix that helped was:

    profile = Selenium::WebDriver::Firefox::Profile.new
    profile.assume_untrusted_certificate_issuer = false
    @browser = Watir::Browser.new(:firefox, :profile => profile)
    

    I still need to understand what this bit of code does but it fixes the problem for us.

     

    Hope it helps you too

    Posted in Software Testing | Tagged , , , | Leave a comment