Unit testing template using QTestLib
authorAki Koskinen <maemo@akikoskinen.info>
Sun, 14 Mar 2010 18:41:18 +0000 (20:41 +0200)
committerAki Koskinen <maemo@akikoskinen.info>
Sat, 20 Mar 2010 10:00:42 +0000 (12:00 +0200)
tests/ut_template/.gitignore [new file with mode: 0644]
tests/ut_template/ut_template.cpp [new file with mode: 0644]
tests/ut_template/ut_template.h [new file with mode: 0644]
tests/ut_template/ut_template.pro [new file with mode: 0644]

diff --git a/tests/ut_template/.gitignore b/tests/ut_template/.gitignore
new file mode 100644 (file)
index 0000000..3e300fc
--- /dev/null
@@ -0,0 +1,2 @@
+Makefile
+ut_template
diff --git a/tests/ut_template/ut_template.cpp b/tests/ut_template/ut_template.cpp
new file mode 100644 (file)
index 0000000..58afcbb
--- /dev/null
@@ -0,0 +1,24 @@
+#include "ut_template.h"
+#include <QtTest/QtTest>
+
+void Ut_template::initTestCase()
+{
+
+}
+
+void Ut_template::cleanupTestCase()
+{
+
+}
+
+void Ut_template::init()
+{
+
+}
+
+void Ut_template::cleanup()
+{
+
+}
+
+QTEST_MAIN(Ut_template)
diff --git a/tests/ut_template/ut_template.h b/tests/ut_template/ut_template.h
new file mode 100644 (file)
index 0000000..91a2b47
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef UT_TEMPLATE_H
+#define UT_TEMPLATE_H
+
+#include <QObject>
+
+class Ut_template : public QObject
+{
+    Q_OBJECT
+
+private slots:
+    // Will be called before the first testfunction is executed.
+    void initTestCase();
+    // Will be called after the last testfunction was executed.
+    void cleanupTestCase();
+    // Will be called before each testfunction is executed.
+    void init();
+    // Will be called after every testfunction.
+    void cleanup();
+
+};
+
+#endif // UT_TEMPLATE_H
diff --git a/tests/ut_template/ut_template.pro b/tests/ut_template/ut_template.pro
new file mode 100644 (file)
index 0000000..0e85b81
--- /dev/null
@@ -0,0 +1,10 @@
+TARGET = ut_template
+QT += testlib
+QT -= gui
+CONFIG += console
+CONFIG -= app_bundle
+TEMPLATE = app
+OBJECTS_DIR = .obj
+MOC_DIR = .moc
+SOURCES += ut_template.cpp
+HEADERS += ut_template.h