MarkUs Blog

MarkUs Developers Blog About Their Project

Functional Testing

with 2 comments

Functional testing is the process of trying to find errors in a software behaviour, or in a software component behaviour. We expect 2 things from functional tests:
  1. Validating that the software does exactly what we expect;
  2. Validating that the software does not do what we not expect it to do.

In fact, the goal of functional testing is not to demonstrate that the software does not contains any error, but to demonstrate that the software does what the client expect it to do.

The functional test could be as simple as testing every behaviour of a program to validate that the behaviour meets the specifications. Usually, proceeding to an exhaustive testing is just unreasonable. There could be to many cases and would be just impossible to test everything in a reasonable time. So it is important to select within all possible behaviours, the ones that ensure the best program coverage. It means, the behaviours that are the most representatives of the program general behaviour and the particular cases.

To do our functional tests, our suggestion is to use Selenium. Selenium is implemented as a Firefox extension, and allows us to record, edit, and debug tests. With Selenium, we can also play back our tests when required.

Selenium Installation

  1. Download Selenium IDE FireFox plugin(http://seleniumhq.org/projects/ide)
  2. Make sure java 1.5 or higher is installed on your computer.
     

How to test with Selenium

1- Open a command window and start the listener

  • Go into the following PATH: selenium-remote-control-1.0.1\selenium-server-1.0.1
  • Type: java -jar selenium-server.jar

2- Open the IDE recorder in FireFox (Tools/Selenium IDE)

 SeleniumRecorder

3- Be sure that your recorder is on and do every step a user would have to do in the application to get the desired action.  Per example if we want to test that a message of success is displayd when an assignment is created do the following:

  • Create an assignment;
  • Right-click on the text: Successfully created assignment;
  • Choose a verification to do.

Selenium menu

4- In the recorder :

  • Stop recording
  • File/Export Test Suit As…/Ruby-Selenium RC
  • Give a representative file name to your test and save it into the following PATH: test/selenium/MyTest.rb

Selenium Export as Ruby

5- The test is exported as Ruby Code and can be modified.  This is how the test code looks like:

SeleniumCode

6- Logout from Markus and run your test

  • Open a command window
  •  Type: ruby test/selenium/MyTest.rb

NOTE:

  • Teardown section should be used to delete all the records created by the test
  • We should also create a program for the login that could be used by every test that requires to login the application.
  • A random string library could also be useful.

For more information about Selenium

http://seleniumhq.org

Written by melagaud

October 6th, 2009 at 6:08 pm

Posted in tests

2 Responses to 'Functional Testing'

Subscribe to comments with RSS or TrackBack to 'Functional Testing'.

  1. […] by Greg Wilson on 2009/10/07 Check out their latest post, or the one before it, or—but you get the picture. Once Canadian Thanksgiving is over, […]

  2. Great write-up, Melanie!

    Mike Conley

    8 Oct 09 at 12:16 pm

Leave a Reply