Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Showcase
  4. CuteTest - Unit testing for Qt

CuteTest - Unit testing for Qt

Scheduled Pinned Locked Moved Showcase
3 Posts 3 Posters 5.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    manski
    wrote on last edited by
    #1

    With CuteTest you can create unit tests and view their results. It's open-source and based on QTestLib but extends it with the following features:

    • You can have multiple test suites (test classes) in a single project.
    • Test suites are registered automatically. No need to manually build the list of test suites.
    • CuteTest provides a public API to retrieve the results of a test run.

    An example of a small test suite:

    @// TestQString.h
    #include<CuteTest.h>

    class TESTSUITE(TestQString) TestQString : public QObject {
    Q_OBJECT
    private slots:
    void toUpperTest() {
    QString str = "Hello";
    QVERIFY(str.toUpper() == "HELLO");
    }

    void toLowerTest() {
    QString str = "Hello";
    QVERIFY(str.toLower() == "hello");
    }
    };@

    This is just a regular QObject-based class. All private slots are test cases (like in QTestLib). The only special thing is the "TESTSUITE" annotation just before the class name. That's it. (You only need to link against CuteTest and QtCore for this to run. See the examples provided by the project.)

    Additionally to the test API CuteTest provides you with a console and a GUI frontend (that are built on CuteTest's API). Especially the GUI frontend make viewing test results much easier than with QTestLib's console output.

    !https://bitbucket.org/mayastudios/cutetest/wiki/cutetestgui-small.jpg(CuteTest GUI frontend)!

    CuteTest has been tested on Windows, Linux (Ubuntu/Gnome), and Mac OS X (Lion). It should, however, run on every operating system that allows the creation of subprocesses.

    Homepage: https://bitbucket.org/mayastudios/cutetest

    1 Reply Last reply
    0
    • S Offline
      S Offline
      shoyeb
      wrote on last edited by
      #2

      cool this means we can directly test our project with cutetest..
      thank u for sharing this..

      There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ashaihullin
        wrote on last edited by
        #3

        Thank you... useful tool...

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved