aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/squish/suiteconf.h
blob: 25e30fa184577c35137fc36de06abea57a82eaf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (C) 2022 The Qt Company Ltd
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <utils/filepath.h>

#include <QString>

namespace Squish {
namespace Internal {

enum class Language { Python, Perl, JavaScript, Ruby, Tcl };

class SuiteConf
{
public:
    explicit SuiteConf(const Utils::FilePath &suiteConf) : m_filePath(suiteConf) {}

    static SuiteConf readSuiteConf(const Utils::FilePath &suiteConfPath);
    static QStringList validTestCases(const QString &baseDirectory);

    bool read();
    bool write();

    QString aut() const { return m_aut; }
    void setAut(const QString &aut) { m_aut = aut; }
    QString arguments() const { return m_arguments; }
    void setArguments(const QString &arguments) { m_arguments = arguments; }
    Language language() const { return m_language; }
    QString langParameter() const;
    Utils::FilePath objectMapPath() const;
    QString objectMapStyle() const { return m_objectMapStyle; }
    QString scriptExtension() const;
    QStringList testCases() const;
    void addTestCase(const QString &testCase);

    QStringList usedTestCases() const;

    bool ensureObjectMapExists() const;
private:
    void setLanguage(const QString &language);

    Utils::FilePath m_filePath;
    QString m_aut;
    QString m_arguments;
    QString m_objectMap;
    QString m_objectMapStyle;
    QString m_testcases;
    Language m_language = Language::JavaScript;
};

} // namespace Internal
} // namespace Squish