Testable models and derived Table models

  • Hi,
    I'm new to the unit testing world in general, and I'm on a new project in which I want to test everything (without falling into testing useless things).

    I have models (QObject -> AbstractModel -> MyModel) which only have an internal id+creationDate and corresponding getters and setters in common (in AbstractModel). They have different properties.

    The models are used in corresponding "Table model" (for i.e.: MyTableModel) and all have and internal QList to store the model, which is sent to the TableModel by reference.

    I need some advice to make my models/TableModels generic testable or at least easily testable, because now I have a lot of copy in models tests (for ids and dates) and in table models. The only differences between the table models tests are the number of properties, which makes every table model different as their internal QList stores different type of data. I've seen a lot of Google results concerning "Model Test" to generically test my QAbstractItemModel subclasses but it seems not to be as easy as on 4.8 (even the 5.0 wiki talks about the 4.8 ModelTest).

    Do you guys have an idea on how I can structure my models and tables to make them easily testable, and if someone has some books about unit testing in Qt, I'd be glad because the tutorial isn't really complete and doesn't explain how to think and write units to be tested.

    Thank you for your help.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.