I'm not sure on how QtTest/QtTest works yet.
I have copied the private folder AND tools folder to the instalation directory.
I'm using qt4 and KDevelop.
So I have a src.pro file, with all the sources and header files plus
CONFIG += qtestlib
I have a 'Lexico' class and a 'TestLexico' class that looks like this:
#ifndef UFPBTESTLEXICO_H
#define UFPBTESTLEXICO_H
#include <QObject>
#include "lexico.h"
#include <QtTest/QtTest>
namespace ufpb {
/**
Classe para testar o as funcoes do lexico
@author Eduardo Santana <edusantana511-ufpb@yahoo.com.br>
*/
{
Q_OBJECT
private slots:
void construtor();
};
}
#endif
#ifndef UFPBTESTLEXICO_H
#define UFPBTESTLEXICO_H
#include <QObject>
#include "lexico.h"
#include <QtTest/QtTest>
namespace ufpb {
/**
Classe para testar o as funcoes do lexico
@author Eduardo Santana <edusantana511-ufpb@yahoo.com.br>
*/
class TestLexico : public QObject
{
Q_OBJECT
private slots:
void construtor();
};
}
#endif
To copy to clipboard, switch view to plain text mode
cpp file:
#include "testlexico.h"
#include <iostream>
namespace ufpb {
void TestLexico::construtor(){
std::cout << "Testing Lexico here...";
}
QTEST_MAIN(TestLexico)
}
#include "testlexico.h"
#include <iostream>
namespace ufpb {
void TestLexico::construtor(){
std::cout << "Testing Lexico here...";
}
QTEST_MAIN(TestLexico)
}
To copy to clipboard, switch view to plain text mode
My src.pro file:
CONFIG += qtestlib
TEMPLATE = app
TARGET += ../bin/compiladorufpb
DEPENDPATH += .
INCLUDEPATH += .
# Input
HEADERS += lexico.h testlexico.h token.h ts.h
SOURCES += compiladorufpb.cpp lexico.cpp testlexico.cpp token.cpp ts.cpp
CONFIG += qtestlib
TEMPLATE = app
TARGET += ../bin/compiladorufpb
DEPENDPATH += .
INCLUDEPATH += .
# Input
HEADERS += lexico.h testlexico.h token.h ts.h
SOURCES += compiladorufpb.cpp lexico.cpp testlexico.cpp token.cpp ts.cpp
To copy to clipboard, switch view to plain text mode
It compiles fine, and generates the compiladorufpb executable, witch is a Hello world application, for now. But, how can I generate the EXECUTABLE TEST for that class ? Does it going to generate one executable for eache TestClass I create ? What else should be done ?
I would be very glad if someone help
Bookmarks