Third Shelf

Software quality

Posted in management, productivity by Sydney du Plooy on December 10, 2011

When it comes to writing software there is always the issue of software quality. How do we decide whether a system is of high quality or not? What do we mean by quality anyway?

Quality in software systems

Businesses are relying more and more on software for running critical business operations. Naturally, every business owner wants his software stable and reliable. Consider other critical systems such as aircraft control systems. I’m pretty sure that you’d want a quality flight control system on board your next flight. Would you board the aircraft if your software was running on the aeroplane?

Another reason we want to ensure quality from an early stage is that bugs and defects accumulate over time. If we fail to correct quality issues from the beginning of the project, there is simply no easy way that we are going to make up for it in the end. Quality must be considered right from the start.

What is software quality?

The quality of a system is partly determined by the user-experience of a system. If it’s user-friendly, stable and reliable it’s quality is perceived as high. If it fails often and produce incorrect information then the system will be perceived as of poor quality. This is known as external quality.

As important as external quality is, internal quality is just as important. Internal quality is about the maintainability and extensibility of the source code. A system that is very difficult to extend and maintain will not be perceived as high quality.

Measuring software quality is tricky and there are two ways in which it is measured, viz.,

  • Direct where the quality is measured directly or observed directly;
  • Indirect where the quality is measured by some indicator of the underlying quality.

Quality factors

Before writing a software system it is necessary to decide on some quality factors. It is the only way to know if we succeeded in delivering a system that is of a specified and agreed quality. We specify the quality factors in terms of the following:

  • Definition of the quality characteristic;
  • Scale of units in which the quality is measured;
  • Test that will be conducted to measure the quality;
  • Minimum acceptable which is the absolute minimum for this quality characteristic to pass;
  • Target range which is the quality number we expect to reach;
  • Now which is the current quality number.

For example, reliability can be made up the following quality factors, viz., availability, mean time between failures, failure on demand and support activity. Related to this is maintainability of which “changeability” and “analysability” are key components.

ISO 9126

According to this standard there are three parties who are interested in the quality of the software, viz.,

  • Acquirers who are the people obtaining the software;
  • Developers who are the people making the software;
  • Independent evaluators who assess the quality of the software.

ISO 9126 defines six external software quality measures, viz.,

  • Functionality is the functions that the software need to offer to satisfy user needs;
  • Reliability is the ability of the software to keep up its level of performance;
  • Usability is the effort needed to use the software;
  • Efficiency is the physical resources used when executing the software;
  • Maintainability is the effort required to make changes to the software;
  • Portability is the ability to transfer the software between environments.

In order to measure the quality between different software systems we have to judge the importance of each quality measure for the application in question. We then select the external quality measures that are relevant to the selected quality measures and create a mapping for the measurements indicating the quality rating, such as:

After that we identify the relevant internal measurements and the intermediate products in which they appear. In other words, the source code must be evaluated and rated according to the set out quality measurements. To derive the final quality number for the systems, we combine the ratings for each system and compare them.

References

  1. Hughes, B. & Cotterell, M. 2009. Software Project Management, 5e. Berkshire: McGraw-Hill Education.

MassFlash v1.0

Posted in productivity, windows by Sydney du Plooy on June 26, 2011

Preparing many flash disks with the same data is tedious and might I add very boring. On my quest to learn Powershell, I might just as well put it to good use. With just a few lines of code I managed to cook up a script to do the mind-numbing work of preparing flash disks. It does the work and I watch. Perfect!

It is a very simple script that:

  1. Formats each flash drive to FAT32;
  2. Copies the contents of the specified directory recursively onto the flash drive;
  3. Dismounts the volume.

The script finds all removable drives between 1gb and 64gb in size. We don’t want to slip up here, now do we?

At the top of the script, a default directory is specified from where all files will be copied if an alternative directory was not specified on the command line.

Write-Host "MassFlash - Version 1.0"
Write-Host "Author: SS du Plooy"
Write-Host "-----------------------"

If($args.Length -eq 0)
{
    $DirectoryToCopy = "c:\DefaultFromCopyLocation"
}
Else
{
    $DirectoryToCopy = $args[0]
}

Write-Host "Preparing flash disks with files from" $DirectoryToCopy
$drives = Get-WmiObject Win32_LogicalDisk -filter "DriveType=2"

Foreach($drive in $drives)
{
    [int] $driveSize = $drive.Size/1073741824 #convert to gigabytes

    If($driveSize -ge 1 -and $driveSize -le 64)
    {
        $driveLetter = $drive.DeviceID
        $volume = Get-WmiObject -Class Win32_Volume -Filter "DriveLetter = '$driveLetter'"
        $label = "TKP"+$(get-date -f ssfff)

        Write-Host Formatting drive $driveLetter [$label] [$driveSize GB]
        $volume.Format("FAT32", $true, 4096, $label, $false)
        Write-Host "Copying $DirectoryToCopy to $driveLetter"
        Copy-Item $DirectoryToCopy $driveLetter -recurse
        Write-Host Dismounting drive $driveLetter
        $volume.Dismount($true, $false)
    }
}
Write-Host "Done."

Now you can put your time and mind to better use instead of preparing flash drives all day long.

Note: The script must be run with Administrator privileges.

Getting Fit, Uncle Bob style!

Posted in .net, productivity by Sydney du Plooy on April 23, 2011

Fit: Framework for Integrated Test

Great software requires collaboration and communication. Fit is a tool for enhancing collaboration in software development. It’s an invaluable way to collaborate on complicated problems–and get them right– early in development.

Fit allows customers, testers, and programmers to learn what their software should do and what it does do. It automatically compares customers’ expectations to actual results. [Cunn 07]

Read an introduction to FitNesse.

Installing FitNesse

To start using FitNesse with .net, you’ll need to download FitNesse and fitSharp. Once downloaded, place the fitnesse.jar file in a directory, for example c:\FitNesse. Extract the files from the fitSharp archive into a subdirectory in the same folder as fitnesse.jar called fitSharp.

Start FitNesse using java -jar fitnesse.jar -p 8080 where -p is the port number. FitNesse installs in a directory called FitNesseRoot. Browse to http://localhost:8080 and you should see the FitNesse front-end.

Creating a test fixture

To use FitNesse you’ll need to give a test fixture that FitNesse can execute. A test fixture is derived from one of the classes provided by the Fit framework. For this example, derive a test fixture from ColumnFixture. This will allow us to run the test case using a decision table with input and output values. Add a reference to both fit.dll and fitSharp.dll in your project.

namespace Humanresources.Domain
{
  public class EmployeeTests : fit.ColumnFixture
  {
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string FullName { get { return string.Concat(FirstName, " ", LastName); }
  }
}


Setting up the test case

To setup the test case, you will need to create a wiki-page. On the front page of FitNesse, click on Edit and enter a wiki-word with the name of the test case. A wiki-word is a word written in Pascal-case surrounded by square brackets, i.e. [EmployeeTests]. Click Save and then click on the question mark to go to the page and click on Edit.

To setup the test, you ‘ll need to define a couple of variables, they are

  1. location of the assembly under test;
  2. how to invoke the test runner;
  3. location of the test runner.
On edit page, enter the following:

!path C:\Projects\Experiments\HumanResources\HumanResources.Domain\bin\Debug\HumanResources.Domain.dll
!define COMMAND_PATTERN {%m -r fitnesse.fitserver.FitServer,c:\FitNesse\FitSharp\fit.dll %p}
!define TEST_RUNNER {c:\FitNesse\FitSharp\Runner.exe}

Click on Save. Next, you’ll need create the test inputs and expected output values:
|humanresources.domain.employeetests|
|firstname|lastname|fullname?  |
|John     |Lidin   |John Lidin |
|Joshua   |Cohen   |J Cohen    |
|Allan    |Butler  |A Butler   |

The first line specifies the class that is under test, the second line specifies the input values that are assigned to the properties with the same name and the following lines give the input and expected output values. The last column with the question mark is the evaluation column. This is a simple decision table. The last column name may also be the name of a method.

In the table, we are assigning the value John to FirstName property and Lidin to the LastName property. The expectation is that FullName is a concatenation of FirstName, a space and then followed by the LastName.

Before the test is run, you’ll need to tell FitNesse that this page is a page that contains tests and is not just a simple wiki-page. To change the page type to test page, click on Properties, select Test and then click Save.

An important thing to note here is that all the property names and class names are in lower case. This is intentional as Pascal-cased words are interpreted as wiki-words. For your own sanity keep them in lowercase.

Your page should now look like this:

Run the test case

Click on Test and you should see the following output:

The tests can also be executed from the command line, are you thinking what I’m thinking?

Troubleshooting

  • Fit.dll file load exception

System.IO.FileLoadException: Could not load file or assembly 'file:///c:\FitNesse\FitSharp\fit.dll'
or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
File name: 'file:///c:\FitNesse\FitSharp\fit.dll' ---> System.NotSupportedException: An attempt was
made to load an assembly from a network location which would have caused the assembly to be sandboxed
in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy
by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please
enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

To solve this issue, simply add a configuration file to the runner that you’re using. If you are using runner.exe then create a file called runner.exe.config and add the following text into runner.exe.config:

<configuration>
   <runtime>
      <loadFromRemoteSources enabled="true"/>
   </runtime>
</configuration>

References

[Cunn 07] Cunningham, Ward. Making Fixtures. Framework for Integrated Test. October 12, 2007. http://fit.c2.com/search.cgi?search=WelcomeVisitors


Jenkins and Git

Posted in reviews, windows by Sydney du Plooy on March 16, 2011

The road split for Hudson and Jenkins. It happens.

Getting the source code…

I don’t have Cygwin or MSysGit installed on the server for my own perverse reasons. In order for Jenkins to get hold of the source code from a git repository is usually straight forward.  Well, now comes the time to get the source code from git. I can clone repository into a local directory using  GitSharp. GitSharp is the .net version of git and very cool, but not quite finished yet.  The alternative is a Java application called JGit. GitSharp, by the way, is a derived work of JGit.

Setting up Jenkins…

Download the shell script of JGit which, by the way,  is a self-contained command line executable. With that, I am able to test the cloning of a repository into a new folder with the following command line:

C:\JGit>java -cp org.eclipse.jgit.pgm-0.10.1.sh org.eclipse.jgit.pgm.Main clone 
http://dev/git/myproject.git c:\projects\myproject

After executing the above command line,  I have the source files in the c:\projects\myproject directory. To use this in Jenkins, I need to make use of the batch command execution since the git plugin makes use of git.exe and all the other things I didn't setup.


After running a build, I have the following console output in Jenkins and the source code in the build factory directory:
 

Started by user anonymous
[MyProject] $ cmd /c call C:\Windows\TEMP\hudson12048252217381411.bat

d:\builds\factory\MyProject>"C:\Program Files\Java\jre6\bin\java.exe" -cp 
c:\jgit\org.eclipse.jgit.pgm-0.10.1.sh org.eclipse.jgit.pgm.Main clone 
  http://dev/git/myproject.git d:\Builds\Factory\MyProject

Initialized empty Git repository in d:\Builds\Factory\MyProject\.git
remote: Counting objects: 342, done
From {0} 
* [new branch]      master     -> origin/master

d:\builds\factory\MyProject>exit 0 Finished: SUCCESS

 


by

Follow

Get every new post delivered to your Inbox.

Join 144 other followers