Software testing tool
 
 
 
 

 
 
STDL Tutorial

Part 1: Getting Started

You need a C#.net development environment installed. STDL works with .NET 3 onwards. This tutorial is based on the visual studio 2005 IDE. It is recommended that you use this version (or later versions) of visual studio. C# express edition is also fine.

Download STDL test automation language
Download NUnit  version 2.4+

Extract the STDL archive to a directory on your hard drive. You should have the following folder structure:

STDL - This folder contains the STDL editor (SciTE for STDL).
STDL\bin - This folder contains the STDL compiler (invoked using SciTE).

Part 2: Toy Example with dates


The following example is just a toy example for a classical software testing problem: the date problem. A method has been created that given a year, month and day, checks whether the date given is valid as follows:



Inside the project, we create a folder called test which contains the unit tests for the whole project. Inside this test folder, we can create our STDL source file (in this case DateCheckAdvanced.stdl). The following is a screenshot of the solution explorer.



We can now fire up the STDL editor (SciTE for STDL) and start hacking away on DateCheckAdvanced.stdl. The first part of the STDL source file is the init section. Under this section, the following information is given:




Following the init section, we move on to define the inputs to the methods. Inputs can be defined as attributes, abstract or as parameters given to the method that is under test. One of the inputs is defined as follows:


Another input is defined as follows:


When it comes to the days, we quickly realise that the days depends on the month and also on the number of days in february. In a leap year, the number of days of February changes from 28 to 29. We therefore define the following abstract input which depends on the year:




Once we have defined these inputs, we can define the final input which is the days input to the method. We can define it as follows:


We also need to define the interface of the method that we're testing. This also defines the mapping between the inputs and the parameters to the given method:
The full stdl source code may be found here.


We're done! We can now compile the STDL source file into an NUnit test. We hit F5 and hopefully a source file called DateCheckerAdvanced.cs is created. The source file contains the following interesting test cases amongst others:

  • 31st December
  • 1st January
  • 29th February 2000 (very rare and special case)
  • 28th February 1800
  • 31st August
  • 0th Month (Negative test case)
  • 13th Month (Negative test case)
  • 0th Day (Negative test case)
  • 32nd Day (Negative test case)


The number of test cases generated is also quite low, this a great advantage to the developer since the test cases would be much more meaningful this way. Also, the test cases generated are quite hard, if they pass it means that the system under test has correct error handling and can handle most of the combinations of unexpected inputs.

We can then test out the project by right clicking on the project -> test with -> NUnit

Through the GUI we can then run all the test cases:



The full example as a visual studio solution is available here.

Part 3: A real example for a Clustering algorithm

Coming soon!

The full example as a visual studio solution is available here.

Slashdot Digg Facebook del.icio.us Newsvine StumbleUpon Reddit Yahoo Fark Technorati Furl Ma.gnolia
Screenshots
 
 
 
            sourceforge.net