Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
ffgiraldez
Posts: 10
Registered: ‎10-18-2011
My Device: Torch 9860

Testing Tools for BB10 Cascades

Hi all

 

I want to know if exist any framework compatible or a tool integrated in Momentics IDE for TDD

 

thanks in advance

BlackBerry Development Advisor (Retired)
smacmartin
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: Testing Tools for BB10 Cascades

You have a choice.

You likely want to use QtTest.

You could also use boost, googletest, CppUnit or others.

 

For QtTest:

- look at  http://qt-project.org/doc/qt-4.8/qtestlib-tutorial1.html

- look at http://qtcreator.blogspot.ca/2010/04/sample-multiple-unit-test-project.html

 

QtTest is bundled with Qt and lets you run tests with signal dispatching.

You need to add to your qmake project file:
     QT += testlib

 

You can define a class for your test, e.g.:

    class TestMyObject: public QObject

    {

         ....

         private slots:

             void test1();

             void test2();

         private:

             MyObject* p;

      }

 

and tests e.g.

 void TestMyObject::test1()

 {

     p->doSomething();

     Q_VERIFY(someConditionMet());

  }

 

In main, TestMyObject test1;  QTest::qExec(&test1, argc, argv);

 

This is where the 2nd link comes in: you'll want it so you can easily run a suite of tests.  Your code will just have #include "AutoTest.h" .... DECLARE_TEST(TestMyObject);    and AutoTest::run(argc, argv).

 

 

BlackBerry Development Advisor (Retired)
smacmartin
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: Testing Tools for BB10 Cascades

Did this answer your question?

If so, please accept the solution; if not, please clarify and I'll see what else I can dig up.

 

Stuart

Developer
Developer
lew
Posts: 174
Registered: ‎03-05-2009
My Device: Dev Alpha

Re: Testing Tools for BB10 Cascades

is there any sample that shows how to integrate qtest with cascades? (mostly datamodel, datasource, ...)