Hello,

I am working on writing tests in "qmlunit" for the qt-components, and here is 
the first minimalist version for that, which contains a single test case for 
Button.

My reference for the testcase: 
[qt-components/tests/auto/api_button/tst_quickcomponentsbutton.cpp]

void tst_quickcomponentsbutton::text() {
        QCOMPARE(componentObject->property("text").toString(), QString("Testing 
Button"));
        componentObject->setProperty("text","Button Tested!");
        QCOMPARE(componentObject->property("text").toString(), QString("Button 
Tested!")); 
}

The testcase written in qml does the same thing:

function test_the_text_of_the_button_can_be_changed() {
        testTarget.text = "CustomName";
        equals(testTarget.text, "CustomName", "The text of the button was 
sucessfully changed"); 
}


What else has been done to run the test case:

* Install qt-components for meego on my desktop
* Download and compile qmlunit (https://github.com/fgrehm/qmlunit) 
* Run the tests using qmlunit  (qmlunit /path/to/TestCaseTest.qml), here in 
this case, /path/to/qmlunit /path/to/tests/auto/api_button/ButtonTest.qml 

I currently have placed the file in the following folder 
(tests/auto/api_button/ButtonTest.qml) in my personal clone of qt-components 
[1] in the qmlunit_tests branch [2], mainly because the testcase in the file 
checks the API.

More testcases will follow soon.

Could you please review the same and provide feedback? 

Thanks,
Aseem
QA, QML Customization team, Tampere

[1]: http://qt.gitorious.org/~ashakunt/qt-components/aseems-qt-components 
[2]: 
http://qt.gitorious.org/~ashakunt/qt-components/aseems-qt-components/commits/qmlunit_tests
 
_______________________________________________
Qt-components mailing list
Qt-components@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-components

Reply via email to