Data Driven Testing
- Test the system with wide set of Data
- Is a Part of Model Based Testing
- Validate boundary conditions and invalid input
From my experience suppose we simulate a Railway Ticket booking, If we call the required APIs Validate Customer->Find Trains->Book Ticket. If I simulate this workflow It appears to me like a model based test case. If I login in UI and do a record & play back using selenium/third party tools this would capture the events and data. This appears like keyword driven testing. Its my understanding. Feel free to write you comments or correct me if I am missing anything.
Design pattern - Detailed, reusable, tried, and tested solution for a recurring problem
Factory Method
- If we have a super class and n sub-classes, and based on data provided, we have to return the object of one of the sub-classes, we use a factory pattern.
- Example and usage listed in Link
- It is a Object Oriented Design Pattern
- General Reusable solution which deals with creation of new objects. Link
- Java Sample Code - http://en.wikipedia.org/wiki/Factory_method_pattern#Java
- Define an interface for creating an object, but let the subclasses decide which class to instantiate
- The Factory Method lets a class defer instantiation to subclasses
interface IClientproperty
{
public String SetRegion();
}
class clientpropertyAPAC implements IClientproperty
{
public String SetRegion()
{
return "Region Value is APAC";
}
}
class clientpropertyUS implements IClientproperty
{
public String SetRegion()
{
return "Region Value is US";
}
}
class clientpropertyEMEA implements IClientproperty
{
public String SetRegion()
{
return "Region Value is EMEA";
}
}
public class FactoryPattern
{
public static void main(String args[])
{
FactoryPattern program = new FactoryPattern();
IClientproperty objBase = program.GetObject("US");
FactoryPattern program2 = new FactoryPattern();
IClientproperty objBase2 = program2.GetObject("APAC");
FactoryPattern program3 = new FactoryPattern();
IClientproperty objBase3 = program2.GetObject("EMEA");
System.out.println("Results\n");
System.out.println("Result One is :"+ objBase.SetRegion());
System.out.println("\nResult Two is :"+ objBase2.SetRegion());
System.out.println("\nResult Three is :"+ objBase3.SetRegion());
}
public IClientproperty GetObject(String Region)
{
IClientproperty objBase = null;
if(Region.equals("US"))
{
objBase = new clientpropertyUS();
}
else if(Region.equals("APAC"))
{
objBase = new clientpropertyAPAC();
}
else if(Region.equals("EMEA"))
{
objBase = new clientpropertyEMEA();
}
return objBase;
}
}
Output
Results
Result One is :Region Value is US
Result Two is :Region Value is APAC
Result Three is :Region Value is EMEA
Abstract Factory Pattern
- Define an interface for creating an object,but let subclasses decide which class to instantiate. Factory method lets a class instantiation to subclasses.
- Provide an interface for creating families of related or dependent objects without specifying their concrete classes
- Example and usage listed in Link
Singleton Pattern
Builder Pattern
Random linked list
More reads.. @ Link
C# Design Pattern–Singleton
C# Design Pattern–Proxy
C# Design Pattern–Factory Method
Good Read
Happy Reading!!
No comments:
Post a Comment