문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top