Thursday, June 23, 2016

A.  Triangle Problem

The second assignment that can be given is the 'Triangle Problem'.

The program reads three numbers as input.  The numbers represent the lengths of the three sides of a triangle. The program determines whether the triangle is scalene (three unequal sides), isosceles (two equal sides), or equilateral (three equal sides). The program displays the result.

An extensive analysis is given in Analyzing the Triangle Problem

Another simple assignment that will help students appreciate testing is the 'Login Problem'.

The program gets userid and passwd from the user as text.  Two options exist - Cancel and Login.
A list of possible test cases for the problem is given in Login Problem

Time taken for each session depends on the strength and weakness of the class.  So, it has to be decided by the instructor.

Software Testing Lab : Session II

Here, we shall look at JUnit first.

1.  Introduce Agile Practices and Test Driven Development (TDD).

2.  Introduce JUnit.  Many tutorials are available that introduce testing as well as JUnit.  For example,
http://www.vogella.com/tutorials/JUnit/article.html
http://realsearchgroup.org/SEMaterials/tutorials/junit/junit_tutorial_3.1.html

Discuss the JUnit framework as well as the constructs that are part of JUnit.  Usually, I get them to download required software and do the above after giving the click for 'Download'.  At the end of the session, the students would have got the material and software ready to implement.

The students follows Test Driven Development methodology to write the test first (JUnit), which will fail.  Run the code and check if it fails.  Now, write the code that will pass the test.

Write test cases and methods for all of the below methods :
subtract(int a, int b)
multiply(int a, int b)
divide (int a, int b)

If it is for novice level students, do not introduce 'Setup()' and 'TearDown()' methods.  It is better to introduce in the next session.  In case students have prior introduction to testing, it is better to get them to design and write test cases with setup() and teardown() methods in mind.

Evaluation :
a.  Check if student has considered the possible scenarios for setup() and teardown().
b.  Time taken for each session depends on the strength and weakness of the class.  So, it has to be decided by the instructor.

Software Testing Lab - A First Exercise

Along with writing posts about Software Testing, thought it would help if I could design a laboratory framework for students in parallel.  So, in the Software Testing Lab Series, the objective is to look at aiding students applying techniques of testing in a laboratory set up.  The scope involves defining objectives, links to reading material, exercises and evaluation.

Session I :

1.  The best way to get an idea of the skills of 'customers' in the software lab, is to test their knowledge in Software Testing.  This can be done through a test, an objective test, which serves as a self-assessment mechanism for students and also gives the faculty an idea of student knowledge.  It would be better that papers are interchanged and students themselves correct.  It serves as reinforcement where correct answers are given, and a correction mechanism in cases of errors.  Usually, I give fifteen questions, at three levels of difficulty - tough, medium, easy.  The reason behind such a scheme is that even the weakest in the class will feel that through continuous work, (s)he can succeed in the lab - even then, some get intimidated :(                A sample is given.

2.  Give an outline of what is to be covered in the lab in 3 minutes.  If there is a syllabi defined, introduce the syllabi. Otherwise, give an outline on the plan for the lab.  Do remember to get a feedback.

3.  Write a Java program called Compute that does the following operations on two integer inputs a and b.

subtract(int a, int b)
multiply(int a, int b)
divide (int a, int b)

Write test cases for the above. Formulate the test cases in a table.

Evaluation :  Check if the students have used Equivalence Class Partitioning techniques for designing test cases.  If yes, they are on the right track.  If not, discuss the technique and motivate them to rewrite.  Exhaustive testing through large number of test cases must be dissuaded.  Being the first exercise, possible test cases maybe listed and discussed.

4.  Manual testing may be done and results noted.

Monday, June 6, 2016

What is testing ?

'Testing is the process used to check if something works'.  It happens every moment of our life.  You clean a plate and you check if you have done it well, you paint a picture and you check if it meets your expectations, you cook and you taste to check if it turns out right.  A bird builds its nest, testing if it is good enough, a rabbit digs a burrow and checks if it is good enough.  So, testing is ubiquitous and is inbuilt in nature.  So, it becomes imperative that software designed and developed needs to be tested.

Testing is defined as the process of executing a program with the intent of finding bugs (i.e. error).  Testing is also done to check how well something works (like the bird).  It can also be defined as the process of validating and verifying to see if the program meets customer requirements.

The word customer is generic.  In the analogy used before, customers include 'you', birds kids and the rabbit herself.  A program may work just fine but if it does not meet customers' requirement, then it is defective.

A natural by-product of testing is increase in quality.  As errors are unearthed and fixed, the quality of the software developed keeps improving.

Hence, testing can be defined as,  'the process used to detect errors in the program ensuring quality'.