Arunkumar Khannur's Software Testing Knowledge Center
   
 

7.8. Data Testing

Data is represented in code as: data types, constants, variables, and records, Data testing focuses on selection of appropriate and proper types and representations for storing data for a specified usage.

Data shall be checked for correctness properties, structural properties, modularity properties, and descriptive properties

7.8.1. Approach for Data Validation
Data may be in any form, viz., Communication Data (messages), Composite Data, Computation Data, Data Structures, Operator Input Data, Security Data, Transaction Data, Concurrently Shared Data, Meta-level Data, Pointer/ Addressing Data. Irrespective of its form, data shall be validated which involves checking for correctness properties, structural properties, modularity properties, and descriptive properties. Defects related to data validation occur mainly because structure involving data may be: un-computable (e.g. divide by zero); inconsistent (e.g. contains side-effects); ineffective (e.g. contains computational redundancy); un-adjustable(e.g. contains numbers). Following section discusses correctness properties, structural properties, modularity properties, and descriptive properties wherein these are appearing as part of them.

At a very high level there are at least two approaches that can be considered for validating the data in the tables,
  • Data Validation using Sample Data
  • Full Validation of Live Data

There are typical database techniques of checking row counts, summary tables and also reviewing the exception logs. Different validation approaches can be adopted to test the data in the table.

Data Validation using Sample Data
Using this approach, instead of verifying all the data that is actually to be moved to production a sample test data is prepared with all the valid and invalid conditions and tested. The test data should be similar to live data and should be in the same format. This type of validation takes lesser amount of time to validate all the conditions\rules that are to be tested. To implement this approach, it is essential that the tester is aware of all the rules that are applied on the raw data and the computations before it is downloaded into the system. A comprehensive sample test data with all positive and negative conditions need to be prepared. The tester would also prepare the correct expected output for the sample feed. In addition to this the tester needs to have a good knowledge on the database that will be used and on the scripting commands. Required access to the database servers would be essential for the testers.

During the testing phase the sample test data prepared would be used as the input to the system. The expected output prepared by the testers would be compared against the actual output generated by the system.

Full Validation of Live Data
This approach is adapted when each and every record that is downloaded into the system is to be validated. Using this approach all validations rules and computations are validated against the live data. The real time scenarios will get tested with this approach. In scenarios where live data is huge in volume and validating entire data would involve considerable amount of time and may not be practical. Many a time access to all the combinations of the live data may not be available to the testers. Some times data used for testing could get merged with live data, leading to confusion and potential disruption to business operations.

Due to the pure volume of data in an enterprise data warehouse, it is not feasible to validate each row that is loaded when significant transformations are involved. To add to the complexity, loading may not be done all at a single point in time, portioned by year.

7.8.2. Examples on Validation of Data
Following are some validation on data at field level.
Date Field Checks
  • Assure that leap years are validated correctly & do not cause errors/miscalculations
  • Assure that month code 00 and 13 are validated correctly & do not cause errors/miscalculations
  • Assure that month 00 and 13 are reported as errors
  • Assure that day values 00 and 32 are validated correctly & do not cause errors/miscalculations
  • Assure that Feb. 28, 29, 30 are validated correctly & do not cause errors/ miscalculations
  • Assure that Feb. 30 is reported as an error
  • Assure that century change is validated correctly & does not cause errors/ miscalculations
  • Assure that out of cycle dates are validated correctly & do not cause errors/miscalculations

Numeric Fields
  • Assure that lowest and highest values are handled correctly
  • Assure that invalid values are logged and reported
  • Assure that valid values are handles by the correct procedure
  • Assure that numeric fields with a blank in position 1 are processed or reported as an error
  • Assure that fields with a blank in the last position are processed or reported as an error an error
  • Assure that both + and - values are correctly processed
  • Assure that division by zero does not occur
  • Include value zero in all calculations
  • Include at least one in-range value
  • Include maximum and minimum range values
  • Include out of range values above the maximum and below the minimum
  • Assure that upper and lower values in ranges are handled correctly

Alpha Field Checks
  • Use blank and non-blank data
  • Include lowest and highest values
  • Include invalid characters & symbols
  • Include valid characters
  • Include data items with first position blank
  • Include data items with last position blank
 

 
Khannur's Book
Arunkumar Khannur, Software Testing - Techniques and Applications, Published by Pearson Publications, 2011 (ISBN:978-81-317-5836-6; Pages:341 + xxii)
Follow Khannur
         
Khannur's Company
ISQT Process & Consulting Services Pvt. Ltd., Bangalore, INDIA
Khannur's Software Testing Forum
STEP-AUTO Forum
 Contact Khannur
ISQT Process & Consulting Services Pvt. Ltd.
#732, 1st Floor, 12th Main,
3rd Block, Rajajinagar,
Bangalore - 560010, INDIA
Phone: +91 80 23012511
URL: www.isqtinternational.com
Email: khannur@isqtinternational.com
Skype: arun.isqt