software testing techniques software testing techniques interface testing presentation on the...

Post on 21-Jan-2016

238 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Software testing techniquesSoftware testing techniques

Interface Testing

Presentation on the seminar

Kaunas University of Technology

What is the interface ?

• In Object-oriented programming interface is what unrelated objects use for communication between them.

• It is a definition of methods and values which the objects agree upon in order to cooperate.

Types of the Interfaces

• Parameter interfaces

• Shared memory interfaces

• Procedural interfaces

• Message interfaces

Parameter interfaces

Function _2

Function_1

Par 1, Par 2, ..., Par n

// Example in C++ language

public class A

{

public:

int Calculate (int a, int b) { return a+b; }

int Calculate (int a) { .. }

int Calculate (int[] sk) { .. }

int Calculate (int* sk) { .. }

};

Shared memory interfaces

Shared memory block

Proc2Proc1 Proc4Proc3

// Example in C++ languagepublic class B{

int* common_number;

public B(){ common_number = NULL; }

public void Assign( int* a){

common_number = a;}

public void CalculateSum( int a){ if(common_number != NULL)

common_number = common_number + a;}

};

// Example in C++ language

int Main(..)

{

common_number;

A Obj1;

A Obj2;

A Obj3;

Obj1.Assign(&common_number);

Obj2.Assign(&common_number);

Obj3.Assign(&common_number);

Obj1.CalculateSum(1);

Obj2.CalculateSum(2);

Obj3.CalculateSum(3);

Return 0;

};

Procedural interfaces (API)

Component1

Func_1(..)

Func_2(..)

...

Func_n(..)

Component2

Func_1(..)

Func_2(..)

...

Func_m(..)

// Example in C# languageinterface IA{

int Calculate( int a, int b);};

public A : IA{

public override int Calculate( int a, int b){

return a + b;}

};

Int Main( … ){

IA Obj = new A();A.Calculate( 1, 2 );

}

Message interfaces

C1 C2

Msg:Init

Msg:Ready

Msg:Request

Msg:Response

Msg:End

...

// Example in C++ languagepublic class D{

public:int computer_nr;

int Calculate(){

int local_sum;…if (computer_nr != 0 ) MPI_Send ( local_sum ) ;else if () MPI_Recv ( local_sum );…

}};

Interface testing

• Interface testing is part of integration testing. • Usually interface testing is carried out by separate team.

Unit testing is carried out by developers themselves.

• The testing team does not posses the source code, so the components to them are like a black box .

• Two perfectly working components can successfully make a third one, which won’t work at all.

Interface errors

• Improperly used interface– A component which is calling another component is

producing errors in its interface.E.g..: Component passes incorrect number of parameters or they are passed in

incorrect order.

• Interface functionality misinterpretation– Functionality of called component is misinterpreted.E.g..: It is considered that if you pass array of 6 vertices to a procedure which draws

triangle, it will draw 2 triangles.

Interface errors (2)

• Synchronization errors– It happens when cooperating components works with

different speeds. E.g..: First component requests another component to fill a Data Table and for some

reason it starts to use it before the second component finishes the requested operation.

Recommendations for interface testing

• Check if returned value is correct– Check how objects are operating with different values

(with boundary values and commonly used);– In case an interface requires multiple parameters it is

required to check different parameter combinations.

Recommendations for interface testing (2)

• Check if component is working correctly if nothing is returned

– Nothing is changed;– Data is being changed (i.e. in Database);– Resources are being changed.

• Check if another interface/event/interrupt is being invoked when it is required.

– Force a component to produce an error and check if it throws an exception.

Recommendations for interface testing (3)

• Also:– Check if interface is invoked in the appropriate

context and under the right circumstances. – Invoke differed interface functions in different order.

Problems of the interface testing

• It may be difficult to determine if system is ready for testing.– E.g..: When performing an interface testing usually there are no

user interface to indicate that system is ready (e.g.. already loaded)

• It may be difficult to initialize required state of the object.• It may be difficult to determine test coverage.

Equivalent subdivision

• It is useful to divide inputs into equivalent groups i.e. such groups that are treated equally by unit which we are testing.

Example

• In case we are testing a procedure which is performing operation with positive two digit number we should check how procedure would react if that number is:– less than 10;– equal to 9 and 10;– from the interval 9 < number < 100;– higher then 100;– equal to 99 and 100;– from interval -100 < number < -9;

Stress testing

• Purpose of the stress testing is to check how system will perform under extreme conditions.E.g..: If system will crash when it will run low on RAM, or what will happen if one of components will be very busy.

• When performing stress testing it is possible to find a weakest place in the System which under extreme conditions will fail first.

Thank you for your attention

Questions

• What types of Interfaces were mentioned?• Who is performing interface testing?• What type of errors are related to using of

interfaces?• What is a stress testing?

top related