Skip to content

varlax77/QSpec

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#QSpec [Build Status] (https://travis-ci.org/ugeneunipro/QSpec)

Introduction

QSpec is a GUI testing library for Qt desktop applications.

Writing Tests

You need create declarations for tests like follow:

#include <core/GUITest.h>
#define GUI_TEST_SUITE "My_base_tests"
    TEST_CLASS_DECLARATION(Test1)
    TEST_CLASS_DECLARATION(Test2)
#undef GUI_TEST_SUITE

Also need create definitions of tests:

TEST_CLASS_DEFINITION(Test1){
    //body of test
}

TEST_CLASS_DEFINITION(Test2){
    //body of test
}

After this you need implement GUITestsLauncher:

#include <core/GUITestsLauncher.h>
class MyGUITestsLauncher: public GUITestsLauncher
{
public:
    MyGUITestsLauncher();
};
MyGUITestsLauncher::MyGUITestsLauncher(): GUITestsLauncher()
{
    guiTestBase.registerTest(new Test1());
    guiTestBase.registerTest(new Test2());
}

In main function of your application you need add something like this:

    QString runGuiTest = qgetenv("HI_GUI_TEST");
    if (!runGuiTest.isEmpty()) {
        MyGUITestsLauncher* tests = new MyGUITestsLauncher();
        tests->connect(&myMainWindow,SIGNAL(si_applicationStarted()),tests,SLOT(sl_runTest()));
    }

Running Tests

A single test can be run just using environment variable 'HI_GUI_TEST'. For Unix systems:

export HI_GUI_TEST=<suite_name>:<test_name>

or for Windows systems:

set HI_GUI_TEST=<suite_name>:<test_name>

And then execute you application.

Requirements

Qt5

  • Linux:
    • X11 Record extension library (sudo apt-get install libxtst-dev)

License

This project available under GNU GPL V2.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 95.9%
  • QMake 1.9%
  • Objective-C++ 1.6%
  • Other 0.6%