Skip to content
  • Nikolai Kosjar's avatar
    Plugin Tests: Support additional test objects/classes · 4f7eb4e6
    Nikolai Kosjar authored
    
    
    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: default avatarEike Ziller <eike.ziller@theqtcompany.com>
    Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@theqtcompany.com>
    4f7eb4e6