Verification and Validation in Software testing

 Verification and Validation in Software testing

Before getting into the various strategies of testing we must understand the process of verifying and validating the software code. Verification and validation is the generic name given to checking processes which ensure that the software conforms to its specification and meets the needs of the customer.

The system should be verified and validated at each stage of the software development process using documents produced in earlier stages. Verification and validation thus starts with requirements gathering phase and continues through design and code(development) reviews to product testing.

Verification will help to determine whether the software is of high quality, but it will not ensure that the system is useful.For example, You are testing an application. The system requirements say there is a field with max Length of 64 characters and Save button. The Use case says that the User will fill the name and save.When checking the presence of the field and the Save button, it is verification. When you follow the use case to use 64 characters, it is validation.

Suppose we have the specifications related to the project than by checking that specifications without executing to see whether the specifications are up to the mark or not is what we have done in verification.Similarly, Validation of the software is done to make sure that the software always meets the requirements of the customer by executing the specifications of the project and product.

Validation: The process of evaluating software during or at the end of the development process to determine whether it satisfies specified requirements.

validation:this is dynamic testing where we have to check the whole software whether its is meeting all required need of customer.

What is Verification?
Verification is a process of evaluating the intermediary work products of a software development life-cycle to check if we are in the right track of creating the final product.

We sometimes tend to neglect the importance of reviewing the documents but we should understand that reviewing itself can find out many hidden anomalies when if found or fixed in the later phase of development cycle, can be very costly.
In other words we can also state that verification is a process to evaluate the mediator products of software to check whether the products satisfy the conditions imposed during the beginning of the phase.

What is Validation?
Validation is the process of evaluating the final product to check whether the software meets the business needs. In simple words the test execution which we do in our day to day life are actually the validation activity which includes smoke testing, functional testing, regression testing, systems testing etc…

 

Verification

Validation

Evaluates the intermediary products to check whether it meets the specific requirements of the particular phase

Evaluates the final product to check whether it meets the business needs.

Checks whether the product is built as per the specified requirement and design specification.

It determines whether the software is fit for use and satisfy the business need.

Checks “Are we building the product right”?

Checks “Are we building the right product”?

This is done without executing the software

Is done with executing the software

Involves all the static testing techniques

Includes all the dynamic testing techniques.

Examples includes:

  • Reviews
  • Walk through
  • Inspections

Example includes all types of testing like smoke, regression, functional, systems and UAT

Verification is the process of evaluating products of a development phase to find out whether they meet the specified requirements. Validation is the process of evaluating software at the end of the development process to determine whether software meets the customer expectations and requirements.
The objective of Verification is to make sure that the product being develop is as per the requirements and design specifications. The objective of Validation is to make sure that the product actually meet up the user’s requirements, and check whether the specifications were correct in the first place.
Following activities are involved inVerification: Reviews, Meetings and Inspections. Following activities are involved in Validation: Testing like black box testing, white box testing, gray box testing etc.
Verification is carried out by QA team to check whether implementation software is as per specification document or not. Validation is carried out by testing team.
Execution of code is not comes underVerification. Execution of code is comes under Validation.
Verification process explains whether the outputs are according to inputs or not. Validation process describes whether the software is accepted by the user or not.
Verification is carried out before the Validation. Validation activitis carried out just after the Verification.
Following items are evaluated duringVerification: Plans, Requirement Specifications, Design Specifications, Code, Test Cases etc, Following item is evaluated during Validation: Actual product or Software under test.
Cost of errors caught in Verification is less than errors found in Validation. Cost of errors caught in Validation is more than errors found in Verification.
It is basically manually checking the of documents and files like requirement specifications etc. It is basically checking of developed program based on the requirement specifications documents & files.

Conclusion Verification and Validation:

  • Facilitates early detection and correction of errors.
  • Encourages and enhances the management intervention and inside into process and product risks.
  • Provide supportive measures towards the software life-cycle process, to enhance compliance with schedule and budget requirements.
  •  Verification means the review activities or the static testing techniques and validation means the actual test execution activities or the dynamic testing techniques.
  • Both are used to finds a defect in different way, Verification is used to identify the errors in requirement specifications & validation is used to find the defects in the implemented Software application.

 

JSON Schema

JSON Schema

What is JSON?
JSON Stands for JavaScript Object Notation. This is a structure that can be used to store data as in key value pair separated by : . JSON can be used to transfer data to and fro any network. It is a simple plain text, it can be consumed by any programming language.

For example the address information can be stored in json format

{
"street":"Station Road"
"city" : "Hyderabad",
"state":"Telengana",
"pincode":"500016"
}

The value may be simple text or it may be an array, or json object as well.

What is JSON Schema?
To validate the values against a given json we can have schema. The schema is a template that can be used to check whether a given JSON is valid or invalid.

For example the above address json the key “city” is supposed to have some values in string/text if the “city” has some arbitary number “3445545” or a decimal values “34.34344” then it can lead to wrong information. The application consuming this JSON will have wrong data. Thus JSON schema help us to define some rules that can be used to validate a JSON.
How to define a JSON Schema?
Consider the following schema for the json structure person

{
"title": "Example Schema",
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"description": "Age in years",
"type": "integer",
"minimum": 0
}
},
"required": ["firstName", "lastName"]
}

The key “title” is the title of the shema.
The key “type” defines the type of json. PersonJson It may be object, array etc.
The key “properties” has the actual definition of the PersonJson.
The firstName of the Person should be of type string
The lastName of the PersonJson should be type string.
The age of the PersonJson should be of type integer. The minimum value is 0
The key “required” in the schema tells which keys are mandatory and should be part of the PersonJson.

The Json schema does not restrict us to define native type but also we can have custom definition.

How to validate the Json against the Schema?
There are various libraries for different programming language to validate the schema against the Json.
Programming Language and popular schema library in json

{
"C": "WJElement (LGPLv3).",
"Java": "json-schema-validator (LGPLv3).",
"Ruby": "autoparse (ASL 2.0); ruby-jsonschema (MIT).",
"PHP": "php-json-schema (MIT). json-schema (Berkeley).",
"JavaScript" : "Orderly (BSD); JSV; json-schema; Matic (MIT); Dojo; Persevere (modified BSD or AFL 2.0); schema.js"
}

More information can be obtained at http://json-schema.org/

Somen                                                                                                                    Sources: internet

Validation Framework in HDI

Validation Framework in HDI

Q) What is validation framework?
Ans) This framework helps to validate the form data in the server side.

 

Q) Which data is validated?
Ans) Every request to the server (GET or POST method) have some parameters which is generally known as formData. The formData is generally a JSON(JavaScript Object Notation) Object. If the formData is not a JSON Object then it is either a key value pair, which we generally refer as query parameters.

Example of request.

 

GET Method

http://www.helicaltech.com/addUser.html?name=Arnold&age=28&mobile=98883888&dateOfRegistration=12/08/2013&action=addUser&qualification=matricualtion 

 

POST Method

http://www.helicaltech.com/adduser.html
           name=Arnold
           age=28
           mobile=98883888
           dateOfRegistration=12/08/2013
           qualification=matricualtion
           action=add

 

POST Method using formData as JSON object

http://www.helicaltech.com/adduser.html

formData{
   "name":"Arnold",
   "Age":28,
   "mobile":"98883888",
   "dateOfRegistration":"12/08/2013",
   "action":"add",
   "qualification":"matricualtion"}

 

Q) How to configure the validation?
 Ans) Basically two files are to be considered for configuring the validation

  1. regex.properties
  2. validation.xml

 

Q) What is regex.properties?
Ans) regex.properties file is a property file. Any data validation regex can be configured here. See more about regular expression here
Example of regex.properties

email=^[A-Za-z0-9._%'-]+@[A-Za-z0-9.-]+\\.[a-zA-Z0-9]+$
IPAddress=^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
text=^[a-zA-Z0-9\\s\\._%\\{\\}\\(\\)%\\?"':@,/]*$
fileName=^[a-zA-Z0-9][a-zA-Z0-9 \\-\\.\\_\\~\\&\\(\\)\\[\\]\\:]+$

here email is the regex key ^[A-Za-z0-9._%’-]+@[A-Za-z0-9.-]+\\.[a-zA-Z0-9]+$ is regex value.

 

Q) What is validation.xml?
Ans) This file we have to map the url which we are going to validate. The url mapping has to be configured in the <mappings> tag

<mappings>
   <url pattern="/addUser.html" definition-file="createUsers.xml" />
</mappings>

 

This means the “/addUser.html” is the url whose request parameters needs to be validated. The definition-file attribute holds the xml file-name where the actual rules are configured.

 

Q) How rules are configured?
Ans)The rules are pretty simple. They are configured in the xml file with the request paramters key as the element and rules as the attribute.

 

For example the createUser.xml is configured as following

<?xml version="1.0" encoding="UTF-8"?>
<formData>
   <action type="text" required="true"/>
   <name type="userName" />
   <age type="number" requiredIf="action" condition="=" value="add" minLength="6" maxLength="60"/>
    <qualification type="text"/>
    <dateOfRegistration type="date" maxLength="60" requiredIf="qualification" condition="=" value="engineer" />
</formData>

 

Q) What is type attribute?
Ans) The type attribute holds the key defined in regex.properties. This attribute is not mandatory. If the request parameter is not empty then this regex is validated against the value of the request parameter.

The type attribute can have multiple key name separated by ,
eg type=”text,notNumber,notSpecialCharaters” here each key regex is validated and, if any of the key is found to be invalid the data is considered to be invalid.

 

Q) What is required attribute?
Ans) The required attribute is used when the request parameter should not be empty. In the above example the action and the name is required.
Q) What is minLength attribute?
Ans) The minLength attribute defines the minimum length (minimum characters) of the value for the request parameter.

 

Q) What is maxLength attribute?
Ans) The maxLength attribute defines the maximum length (maximum characters) of the value for the request parameter.

 

Q)What is length attribute?
Ans) When we know that the request parameter has to have the exact length then we can use this attribute.

 

Q) What is requiredIf attribute?
Ans) Sometime one parameter is dependent on another parameter . For example the dateOfRegistration is required if qualification is engineer.

With requiredIf attribute two more attribute condition and value need to be set

The condition attribute can have any operator eg. =, <= , >=, ==, != etc

The value attribute should have the value which is a rule.

<qualification type="text"/>
    <dateOfRegistration type="date" maxLength="60" requiredIf="qualification" condition="=" value="engineer" />