Skip to main content

Minimal test cases to catch bugs in the Calendar Date to Day convertor

 

Here’re the fields and respective input values against which the Date to Day convertor can be tested (left-side-table):

Month Day Year       Month Day Year
1 1 2010       2 28 2010
2 2 2011       4 29 2011
3 3 2012   image   12 30 2012
4 4           31  
5 5            
6 6            
7 7            
8 8            
9 9            
10 10            
11 11            
12 12            
  13            
14            
15            
16            
17            
18            
19            
20            
21            
22            
23            
24            
25            
26            
27            
28            
29            
30            
31            

However, to break the software, a smaller set of values is sufficient enough!

We can apply Boundary Value Analysis method at the upper end of days range to consider:

  1. 1 case of a month having max 30 days
  2. 1 case of a month having max 31 days
  3. 2 cases for the month of February (max 28, 29 days)

Thus, our set of values reduces to the second table shown above. Here we have randomly picked months 4, 12 and 2 respectively.

Let’s take a closer look!

image

To consider both positive and negative test scenarios, we consider:

  1. An even numbered year (2010)
  2. An odd numbered year(2011)
  3. A leap year(2012)

Now even this reduced set of values for Year, Month and Days of Month can lead to an overwhelming set when we consider the possible combinations that can be used to input data in the form. The number would be

= (Number of Month Values) * (Number of Year Values) * (Number of Day Value)

= 3 * 3 * 4

= 36

However, there’s a more efficient scientific technique available!

So, let’s feed the reduced set of data to the All Pairs program from satisfice.com

Here’s the raw set of test cases derived by the program:

Month Day Year
2 28 2010
4 28 2011
12 28 2012
2 29 2011
4 29 2010
12 29 2010
2 30 2012
4 30 2010
12 30 2011
4 31 2012
2 31 2010
12 31 2011
~2 29 2012

Categorize it:

Test generation method Month Day Year Test type
Program generated 2 28 2010 +ive
Program generated 4 28 2011 not required
Program generated 12 28 2012 not required
Program generated 2 29 2011 -ve
Program generated 4 29 2010 not required
Program generated 12 29 2010 not required
Program generated 2 30 2012 -ve
Program generated 4 30 2010 +ve
Program generated 12 30 2011 not required
Program generated 4 31 2012 -ve
Program generated 2 31 2010 -ve
Program generated 12 31 2011 +ve
Program generated ~2 29 2012 consider as additional case for Month value 2 only
Additional cases 2 29 2012 +ve

Filter it:

Test generation method Month Day Year Test type
Program generated 2 28 2010 +ive
Program generated 2 29 2011 -ve
Program generated 2 30 2012 -ve
Program generated 4 30 2010 +ve
Program generated 4 31 2012 -ve
Program generated 2 31 2010 -ve
Program generated 12 31 2011 +ve
Additional cases 2 29 2012 +ve

Execute these and report the bugs!

Comments

Popular posts from this blog

Experimenting with Visio and VBScript

This diagram is created:               using this code:                                                                         Copy the code: Option Explicit Dim strVSDPath, filesys Dim vsoApplication, vsoDocument, vsoPages, vsoPage Dim vsoMaster1, vsoMaster2, vsoStencil Dim vsoShape1, vsoShape2, vsoConnector1 Dim itr Const visAutoConnectDirDown = 2     'Connect down. Const visAutoConnectDirLeft = 3     'Connect to the left. Const visAutoConnectDirNone = 0     'Connect without relocating the shapes. Const visAutoConnectDirRight = 4     'Connect to the right. Const visAutoConnectDirUp = 1         'Connect up. ' Visio file to be created. strVSDPath = "D:\Workspace_Visio\TestRunFlow.vsd" 'delete any previously existing Suite file Set filesys = CreateObject("Scripting.FileSystemObject") If filesys.FileExists(strVSDPath) Then     filesys.DeleteFile strVSDPath End If Set filesys = Nothing &#

Excel Automation and a palatable QTP Suite

  Excel automation and VBScript can be used to create a test suite that can control the run sequence of QTP scripts and present a Summary report of the automation run cycle. Its simple enough to double-click an icon and the VBScript program will create an excel sheet, populated with all the scripts from a Test folder. Here’s the folder structure: Click here to get the files.   The CreateSuite.vbs program creates an excel sheet .. .. and populates it with all the QTP scripts from the Tests folder (folder hierarchy within the Tests folder does not matter, a valid script folder will be fetched). Here’s how the excel sheet looks after running the CreateSuite program: This Test Suite has been created in the TestSuite folder, as the Suite.xls file: Once the list of tests is available, one can choose to configure a subset of the listed tests to be run, like in the case below, we turn off the fourth test: Now that the list of tests to be run is ready, we

QTP – search sub-folders for existence of QTP scripts

  Suppose we want to report on all subfolders in a specific root folder that contain script files. Consider the example folder structure here – ODBC_MYSQL, ODBC_SQLEXPRESS and Test1 are the folders that have QTP scripts: Here’s a VBScript program that takes the root (start) folder as input, and iterates all subfolders recursively to report on the ones that are actual QTP script folders: Note: This program can be run directly as a VBScript program, or from within a QTP script by toggling the comment between lines 17 and 18. (p.s.: if Print statement does not work on specific version of QTP, use the Msgbox statement. For real world test automation projects, do not use either – to avoid human intervention!) On running the program, Folders across various levels (Level 2, 3) get reported!