23
Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

Embed Size (px)

Citation preview

Page 1: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

Software testing techniquesSoftware testing techniques

Interface Testing

Presentation on the seminar

Kaunas University of Technology

Page 2: Software testing techniques Software 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.

Page 3: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

Types of the Interfaces

• Parameter interfaces

• Shared memory interfaces

• Procedural interfaces

• Message interfaces

Page 4: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

Parameter interfaces

Function _2

Function_1

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

Page 5: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

// 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) { .. }

};

Page 6: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

Shared memory interfaces

Shared memory block

Proc2Proc1 Proc4Proc3

Page 7: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

// 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;

};

Page 8: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

Procedural interfaces (API)

Component1

Func_1(..)

Func_2(..)

...

Func_n(..)

Component2

Func_1(..)

Func_2(..)

...

Func_m(..)

Page 9: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

// 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 );

}

Page 10: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

Message interfaces

C1 C2

Msg:Init

Msg:Ready

Msg:Request

Msg:Response

Msg:End

...

Page 11: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

// 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 );…

}};

Page 12: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

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.

Page 13: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

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.

Page 14: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

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.

Page 15: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

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.

Page 16: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

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.

Page 17: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

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.

Page 18: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

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.

Page 19: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

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.

Page 20: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

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;

Page 21: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

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.

Page 22: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

Thank you for your attention

Page 23: Software testing techniques Software testing techniques Interface Testing Presentation on the seminar Kaunas University of Technology

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?