diff options
author | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2015-01-15 13:14:35 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2015-02-04 09:14:45 +0000 |
commit | 4f7eb4e6b8fe6ec8612c9ddf9172954db03ec32e (patch) | |
tree | 343c75ad105835eb342e69b1168152ba23aefbea /src/libs/extensionsystem/iplugin.cpp | |
parent | 2992653a4d4e3f1a4602c573cb3052f610c2a7b3 (diff) | |
download | qt-creator-4f7eb4e6b8fe6ec8612c9ddf9172954db03ec32e.tar.gz |
Plugin Tests: Support additional test objects/classes
So far tests running within Qt Creator could be implemented with a
private slot in the plugin class starting with "test".
Binding the test functions to the plugin object/class is fine for test
functions without side effects. But as soon as side effects come into
play we need proper initialization and cleanup as it's provided by
init(), cleanup(), initTestCase() and cleanupTestCase(). However,
implementing these functions in the plugin class is not appropriate
since they would affect (potentially quite diverse) test functions.
This patch enables us to provide 'ordinary' test classes in which we can
handle initialization and clean up the usual way.
In addition to the current test invocations, e.g.:
# (1) Run all test functions of the plugin
./qtcreator -test CppTools
# (2) Run selected test functions of the plugin by stating them
./qtcreator -test CppTools,test_completion,test_builtinsymbolsearcher
# (3) Run selected test functions of the plugin by a wild card
# expression
./qtcreator -test "CppTools,*pointerdeclaration*"
# (4) Run a test function of the plugin with certain test data
./qtcreator -test CppTools,test_completion:template_1
it's now also possible to state the test class in order to execute all
test functions of that class:
# Run all test functions of a certain class:
./qtcreator -test CppTools,SomeClassWithTests
As long as the test class does not start with "test", there should not
be any problems.
Further, an invocation like (1) now additionally execute all test
functions of all test classes. For invocations of type (2), (3) and (4)
all test functions of all test classes are considered, too.
Change-Id: Ief08a6e9e451c599fd0109b8b8e57f92e3ee19f2
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'src/libs/extensionsystem/iplugin.cpp')
-rw-r--r-- | src/libs/extensionsystem/iplugin.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libs/extensionsystem/iplugin.cpp b/src/libs/extensionsystem/iplugin.cpp index 6df04c6406..66e1e9ce0a 100644 --- a/src/libs/extensionsystem/iplugin.cpp +++ b/src/libs/extensionsystem/iplugin.cpp @@ -205,6 +205,20 @@ IPlugin::~IPlugin() } /*! + \fn QList<QObject *> IPlugin::createTestObjects() const + + Returns objects that are meant to be passed on to QTest::qExec(). + + This function will be called if the user starts \QC with '-test PluginName' or '-test all'. + + The ownership of returned objects is transferred to caller. +*/ +QList<QObject *> IPlugin::createTestObjects() const +{ + return QList<QObject *>(); +} + +/*! \fn PluginSpec *IPlugin::pluginSpec() const Returns the PluginSpec corresponding to this plugin. This is not available in the constructor. |