Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QTest tests not showing in navigation window.



  • Hiya,

    New to using Qt Test and really getting used to my data driven tests showing up in the left nav window which I can select/deselect for testing. Note the test named 'perft_suite' in the image below.

    Qt-Test-Navigation.png

    I've got about 500+ data driven tests that don't show in perft_suite. The only difference I can see between these and the ones that do show is that I'm loading the tests from a file like this:

    void ChessValidator::perft_suite_data()
        {
        QFile epd_suite(QDir::currentPath() + "/perftsuite.epd");
    
        if (!epd_suite.open(QIODevice::ReadOnly | QIODevice::Text))
            {
            return;
            }
    
        QTest::addColumn<QString>("fen");
        QTest::addColumn<int>("depth");
        QTest::addColumn<qint64>("nodes");
        QTextStream in(&epd_suite);
    
        while (!in.atEnd())
            {
            QString line = in.readLine();
            line.remove('\n');
            QStringList parts = line.split(';');
    
            if (parts.size() < 2)
                {
                continue;
                }
    
            QString fen = parts[0].trimmed();
    
            //for (int j = 1; j < parts.size(); j++)
            for (int j = 1; j < 3; j++)
                {
                QString depth_nodes = parts[j];
                depth_nodes = depth_nodes.trimmed();
                QStringList dn_parts = depth_nodes.split(" ");
                int depth = dn_parts[0].mid(1).toInt();
                qint64 nodes = dn_parts[1].toLong();
                QString description = QString("perftsuite D=%1 N=%2 fen=%3").arg(depth).arg(nodes).arg(fen);
                QTest::newRow(qPrintable(description)) << fen << depth << nodes;
                }
            }
        }
    

    Whereas, the others are specifically loaded, like this:

    void ChessValidator::fen_loaded_data()
        {
        QTest::addColumn<QString>("fen");
        QTest::newRow("fen test: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1") << "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" ;
        QTest::newRow("fen test: n1n5/PPPk4/8/8/8/8/4Kppp/5N1N b - - 0 1") << "n1n5/PPPk4/8/8/8/8/4Kppp/5N1N b - - 0 1" ;
        }
    

    I'd like all 500+ from perft_suite_data() to show so that I can select just the failing ones for re-test. Does anybody have any idea how to get them to show, maybe even manually by editing some config file?

    Thanks!


Log in to reply