Question

If I were to create a unit test for class implementation using QTestlib ( trying to figure it out) how would I do it. (I know unit testing for the simple class below can be done other simple way I trying to understand QTestlib framework and whether its really what I want)

Consider a simple class ( just to make things really clear )

//Add.h

class Add {
           public:
           int add (int a , int b);
};


//Add.cpp 

int Add::add(int a, int b)
{
int c=0;
c=a+b;
return c;
}

How should I use QTestlib to test this class? Some info would be great.

If this isnt the right way. Let me know. Also some info on automated testing would be nice.

Was it helpful?

Solution

Take a look at http://doc.trolltech.com/4.6/qtestlib-manual.html#creating-a-test, it explains step-by-step how to create a test using QTestLib in a very accessible way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top