Skip to content

Latest commit

 

History

History
111 lines (71 loc) · 2.7 KB

project-item.rst

File metadata and controls

111 lines (71 loc) · 2.7 KB

Project Item

Locations

document root

Nested items

:qmlMatrix, :qmlTestcase

Properties

:cppname, :cppreferences, :cppworkingDirectory

Detailed Description

A Project item represents a collection of of test cases. Test cases can be defined in two ways:

  1. in-line

    Usually used for a bunch of trivial test cases with only few lines or if complex test cases are instantiated multiple times with slightly different configuration.

    The test cases are executed in undefined order.

    Example in-line project:

    Project {
        name: "inline-project"
    
        Testcase {
            name: "trivial-1"
            function run() {
                // Qst.verify(...)
            }
        }
    
        // Assuming that ComplexTestcase.qml exists in the current
        // directory
        ComplexTestcase { name: "complex-1"; config: "something" }
        ComplexTestcase { name: "complex-2"; config: "something-else" }
    
    }
  2. as references

    Usually used in non-trivial projects. Test cases are defined in their own files and then referenced by the main project file. Any property prop attached to the project item is available in sub-items as project.prop.

    The execution order is defined by their occurrence order in the :cppreferences item.

    Example references project:

    Project {
        name: "referencing-project"
        property string someProperty: "sometext"
    
        // someProperty is available in all test cases as
        // project.someProperty
        references: [
            "testcase1.qml",
            "testcase2.qml"
        ]
    }

Properties