Subscribe by Email


Showing posts with label Details. Show all posts
Showing posts with label Details. Show all posts

Monday, July 9, 2012

List out the technical details of mock object?


Mock objects are much in talk these days and seem to be marking themselves as one of the effective tools in carrying out unit testing. 

What are Mock Objects?


- Mock objects are simulated objects counterparts of the original or the non mock object that is intended to mimic the behaviour and working of the original non mock object in a way that is controlled and defined. 
- Classes with heavy code bases are such a pain to test and can be tested only by the mock objects. 
- Ever tried implementing unit tests in a project but failed to do so because of the dependency of the module and difficulty in its isolation?
- Within a budget and time constraint it becomes difficult for configuring and setting up all the external dependencies of the modules. 
- Mock objects are a feasible option for overcoming such problems. 
- Problem with most of the mock tools is that they do not come with documentation so it becomes difficult to work them out. 
- These technical details of mock objects are the center point of this article. 
- Since the mock objects simulate the real object, they are said to possess the same interface as that of the real objects that they are imitating. 
- Nowadays many mock object frame works are available using which the programmers and developers can specify which all methods are to be invoked by the mock object and in which order. 
- Also, the parameters that have to be passed to the mock object can be specified along with the values that will be returned by the mock object. 
- We have divided the technical details of the mock objects in to three categories:
1. Mocks, fakes and stubs
2. Setting expectations
3. Writing log strings

Mocks, fakes and stubs: 
- Some consider the mock objects and fakes to be different things saying that the fakes are much simpler than the mock objects. 
- The fakes are simply used to represent just the interface of the object which they are mimicking and responses that they return are pre-arranged. 
- Thus, we can say a set of method stubs is provided by the fake objects. 
- On the other hand, the mock objects are fake objects but they help in determining whether some other object passes or fails the test to which it is subjected. 
- It does so by the verification whether of the interaction if any took place on the object. 
Everything else apart from these two i.e., fake objects and mock objects is considered to be a stub. 
- Stub is anything unreal is fake and based up on its usage it can be classified as stubs and mocks. 
- Mock objects possess a little more functionality which is that their method implementations contain assertions that are truly theirs. 
- This furthermore implies that the context of each and every call is examined by the true mock object.
- The examination includes the checking of the order of calling of the methods and performing tests on the data that has been passed as arguments to the method calls.

Setting expectations: 
It is ensured by a mock setting that the calls to the system will cause the system to throw some exception like getting hanged or crashing.

Writing log strings: 
Mock methods can be used to make an entry to the public log strings which otherwise could result in invisible performance sapping bugs.


Monday, February 13, 2012

What is meant by novice testers? How should they perform software testing?

WHO IS A NOVICE TESTER?

- A novice tester as we all know is a tester who is new in the field of software testing.
- He does not have any past experience and they have so many queries about the matters regarding the software testing field.
- They also have many doubts regarding the work that they have to do.
- Though being a novice tester, he/ she must be well versed with the basic principles of the field and disciplines to be followed.

Here I’m going to discuss some ways to help novice testers in improving their software testing skills. Follow the tips being mentioned and get great benefits:

1. HAVE FULL INFORMATION ABOUT THE APPLICATION

- Have full information about the application that you are going to test.
- You should understand what are its requirement functionalities and non requirement functionality.
- Performing software testing without the knowledge of the software program or application will lead you nowhere.
- Lack of understanding will not be able to decide that whether the output that you have obtained is correct or not.
- You will not be able to tell if the functionality under test is working properly or not.
- You will not be able to notice the absence of any functionality.
- Therefore, having a full detail of the software program or application under testing is necessary.

2. KNOWLEDGE ABOUT DOMAIN

- Like about software program or application, you should also have knowledge about your domain.
- Knowing about one’s domain solves many problems.
- Once you know about your domain, you will be able to suggest better solutions for the errors and bugs in the program.
- The more you keep your solutions in the limits of the domain, the more value your suggestions will get.
- Don’t just catch the bug; provide them counter measures also to curb them.
- Another problem that will be solved is of test cases.
- You will have better criteria to design your test cases up on.
- Your test cases will be capable of providing enough coverage to the code.

3. KEEP YOURSELF UP-TO-DATE WITH AVAILABLE TECHNOLOGIES

- Keep learning about the available technologies in the field as well as keep yourself updated with the new upcoming technologies.
- Come out with new practical ways for providing better solutions to the testing problems rather than just relying on the knowledge from the books.
- Learn with experience more than books.
- Design your own working procedures.
- It is not necessary to stick to the old pre designed procedures until and unless you don’t have an option.
- Keep rejuvenating your existing knowledge.

4. AVOID MAKING ASSUMPTIONS

- Don’t make assumptions. Assumptions don’t work for software testing.
- Never assume that the software program or application will be error free.
- This will be a mistake and will lead you to serious consequences.
- It is the duty of tester to look for bugs and errors.
- You cannot make sure that a program or application is error free and there is no need for testing.

5. GIVE YOUR BEST IN DISCOVERING ERRORS

- Testing an application over and over again still won’t make it 100 percent error free.
- Keep on discovering errors and bugs and give your best in correcting them.
- Have a priority list which will guide you about the testing sequence i.e., which functionality is to be tested first and so on.

6. DO NOT LIMIT YOUR THINKING

- Always think that you’re the end user and perform testing.
- Don’t limit your thinking to the designation of a tester but, think like a user also.
- This helps in many ways.
- You will be able to make out that what functionality IS important and need to be introduced in the software program or application that were missing previously.
- Think how this software application will be used by the user and what can be his expectations.
- All this will help you in making your software user friendly.


Thursday, September 15, 2011

Some details about Pointers and Structures in C...

A pointer can be defined as a variable pointing to another variable or a variable storing the location or address of another variable.Pointers can be used to point to any data type.There are object pointers, function pointers, structure pointers and so on. Like any other pointers, structure pointers are also a very useful tool in C programming.Pointer structures are easy to declare and declared similarly like any other kind of pointer by putting a “*” sign before the name of the structure. See the example below:

Struct address *a1, *a2;
a1 = &b2;
a2 = &b3;

where b2 and b3 are the actual structure address variables. Using the below given assignment statement you can copy the details of structure pointed by a2 to a1:

*a1 = *a2;

Any member of a structure can be accessed using a pointer in the following way:
A->b

Here A is a pointer pointing to a structure and b is a data member or a member function of the structure being pointed. And there’s another way to access a member of a structure which has been given below:

(*A).b;

Both the statements are equivalent. Use of structure pointers is very common and useful.Be careful while dealing with structure pointers like any other normal pointer.The precedence of operators matters a lot. Be careful with the precedence of operators while programming in C.If we enclose *A is parentheses, an error will be generated and the code will not be compiled since the “.” Operator has got a high precedence than the”*” operator.Using so many parentheses can be quite a tedious job so, C allows us to use a shorthand notation to reduce the bombastic jargon. ” (*A).” can also be written as given below:

A ->

This is equivalent to (*A). but takes less characters. We can create pointers to structure arrays. A lot of space can be saved if we declare an array of pointers instead of an array to structures. In this only one structure is created and subsequently values are entered and disposed. Even structures can contain pointers as shown below:

Typedef struct
{
Char a[10];
Char *b;
} c;
c d;
char e[10];
gets(d.a,10);
d.b = (char *) malloc (sizeof (char[strlen(e)+ 1]));
strcpy(d.b, e);


This method is implemented when only a few records are required to be stored. When the size of the structure is large, it becomes difficult to pass and return the structures to the functions. To overcome this problem we can pass structure pointers to the functions. These structures can be accessed indirectly via pointers. Given below is a small code to illustrate the passing of structure pointers to the function and accessing them:

struct product
{
Int pno;
Float price;
};
Void inputpno (struct product *pnoptr);
Void outputpno (struct product *pnoptr);
Void main()
{
Struct product item;
Printf(“product details\n\n”);
Inputpno (&item);
Outputpno (&item);
}
Void outputpno (struct product *pnoptr)
{
Printf( “product no. = %d, price = %5.2f \n”, ( *pnoptr). Pno, (*pnoptr).price);
}
Void inputpno (struct product *pnoptr)
{
Int x;
Float y;
Struct product pno;
Printf( “product number: “);
Scanf( “%d”, &x);
( *pnoptr).pno = x;
Printf ( “price of the product: “);
Scanf( “%f”, &y);
( *pnoptr). Price = y;
}


In this program code, the prototypes, function calls and definitions have been changed in order to work with structure pointers. Dereferencing of a structure pointer is very common in programs. “->” (arrow) is an operator that is provided by C for accessing the member function of a structure. The 2 statements given below are equivalent:

Pnoptr -> pno;
(*pnoptr).pno;


Wednesday, January 12, 2011

Model Driven Architecture (MDA) - Advantages and MDA Process

The MDA is a new way of writing specifications, based on a platform-independent
model.

Why should we use Model Driven Architecture


- Portability
- Interoperability
- Domain facilities provide much wider interoperability.
- MDA allows to model the functionality and behavior only once, therefore saves a lot of time.
- Requirements are always changing.
- New technology is arising.
- Require to integrate old system with new system, and any other system in future.
- MDA makes it easier to integrate applications and facilities across middle-ware boundaries.

Model Driven Architecture Process


THE BASIC PROCESS
- To construct a MDA application, the first step is to create a computation independent model(CIM) by a business analyst.
- The CIM is transformed into platform independent model(PIM) by enterprise architect.
- The resulting PIM has to be targeted to a platform to complete the build process.
- The transformation of a PIM to a PSM will be done by a platform specialist.

THE COMPLEX PROCESS
The process from computation independent model to platform specific model can be a bit more complex.
- Between the models, there can be some gaps present which makes transformation difficult.
- As a result, you can have interrelated models having different layers of abstraction.
- One consequence is that a single layer of abstraction can have horizontal transformations. Consider the example where a PIM is converted multiple times into more detailed PIMs. And there are vertical transformations in addition to vertical transformation of models.


Model Driven Architecture (MDA) - Characteristics and Viewpoints

OMG was formed as a standards organization to help reduce complexity, lower costs, and hasten the introduction of new software applications.
- The Object Management Group (OMG) adopted the Model Driven Architecture as an approach for using models in software development.
- Its three primary goals are portability, interoperability and reusability through architectural separation of concerns.

Characteristics of Model Driven Architecture(MDA)


- MDA enables development of new specifications.
- MDA provides a comprehensive, structured solution for application interoperability and portability into the future.
- MDA consists of services specified by OMG. It also includes directory services, event handling, persistence, transactions, and security.
- MDA enables the creation of standardized domain models for some vertical industries.
- MDA separates the operation of the system from the way it uses its capabilities of its platform.
- MDA enables converting platform-independent models to produce platform-specific models using mappings.

What are different viewpoints of Model Driven Architecture


- The first viewpoint is called Computation Independent Viewpoint which focuses on environment and requirements of the system rather than the details of system's structure and processing.
- The second viewpoint is called Platform Independent Viewpoint which focuses on how the system operates. It hides the details necessary for a particular platform. The part of complete specification does not change when the platform changes.
- The third viewpoint is called Platform Specific Viewpoint which focus on the detail of the use of a specific platform in addition to platform independent viewpoint.


Facebook activity