Skip to content
QiTASC.com / intaQt Tutorials / Getting Started with intaQt Client /
Execute Features Using an XML Configuration File
/ .. / .. /
Execute Features Using an XML...





Execute Features Using an XML Configuration File

Using intaQt Client with an XML configuration file enables you to version control your execution logic and generates a JUnit-compliant XML report, which can be used with various continuous integration systems.

The tutorial uses four Feature Files: Feature1.feature to Feature4.feature.

1. Configure the XML File

The tag TestSuiteCollection can contain multiple TestSuites, which in turn are comprised of one or more test cases within the TestCase tag. The TestSuite name will appear in the XML output. The TestCase name will show as classname and can be used to group various tests by class, for example Voice or Data. Each TestCase must have exactly one TestScript.

The TestScript attribute file specifies the Feature File to execute while workdir specifies the report output directory. The directory can either be a path relative to intaqt-cli/bin or an absolute path, for example, C:/QiTASC/reports/reportOfFeature1.

Create an XML file called intaQtClientConfiguration.xml. Copy and paste the following into the file, then save it:

1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="UTF-8" ?>
<TestSuiteCollection>
    <TestSuite name="TestSuite1">
        <TestCase name="TestCaseClassName">
            <TestScript file="Feature1.feature" workdir="../relativeToBin/one"></TestScript>
        </TestCase>
    </TestSuite>
</TestSuiteCollection>

2. Run the Test Suites

Execute the following from your command line:

1
./intaqt test HowTo-IntaQtClient intaQtClientConfiguration.xml

Run the above command, and it produces output similar to the following:

1
2
3
4
5
6
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="0" hostname="qvie"
    name="TestSuite1" tests="1" time="5" timestamp="2018-02-22T13:47:31.02">
    <testcase classname="TestCaseClassName" name="ScenarioName1" time="5"/>
    <system-out/>
</testsuite>

The name attribute from the <testcase> tag will be the feature's Scenario name.

Note
When executing more than one Feature File, it is highly recommended to use the -s or --summary command line switch to output a JUnit-compliant summary of the test run. If the switch is omitted, there will be a single intaqt.xml file for every feature, which will be overwritten when multiple Feature Files share the same workdir. The output file can be specified by either a relative or an absolute path.

Example

1
./intaqt test HowTo-IntaQtClient intaQtClientConfiguration.xml -s C:\QiTASC\output.xml

3. Execute Multiple Features

Add TestCase tags to the configuration XML file to execute multiple Feature Files:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="UTF-8" ?>
<TestSuiteCollection>
    <TestSuite name="TestSuite1">
        <TestCase name="TestCaseClassName1">
            <TestScript file="Feature1.feature" workdir="C:/QiTASC/intaqt-cli/bin/absolutePath/F1"></TestScript>
        </TestCase>
        <TestCase name="TestCaseClassName2">
            <TestScript file="Feature2.feature" workdir="C:/QiTASC/intaqt-cli/bin/absolutePath/F2"></TestScript>
        </TestCase>
        <TestCase name="TestCaseClassName3">
            <TestScript file="Feature3.feature" workdir="C:/QiTASC/intaqt-cli/bin/absolutePath/F3"></TestScript>
        </TestCase>
        <TestCase name="TestCaseClassName4">
            <TestScript file="Feature4.feature" workdir="C:/QiTASC/intaqt-cli/bin/absolutePath/F4"></TestScript>
        </TestCase>
    </TestSuite>
</TestSuiteCollection>

4. Run the Test Suites

Run the following in the command line:

1
./intaqt test HowTo-IntaQtClient intaQtClientConfiguration.xml

Run the above command, and it produces output similar to the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="1" hostname="qvie"
    name="TestSuite1" tests="5" time="47" timestamp="2018-02-22T14:23:48.995">
    <testcase classname="TestCaseClassName" name="ScenarioName1" time="13"/>
    <testcase classname="TestCaseClassName" name="ScenarioName2" time="7"/>
    <testcase classname="TestCaseClassName" name="ScenarioName3" time="12">
        <failure message="ScenarioName3 FAILED"/>
    </testcase>
    <testcase classname="TestCaseClassName" name="ScenarioName3a" time="6"/>
    <testcase classname="TestCaseClassName" name="ScenarioName4" time="9"/>
    <system-out/>
</testsuite>

Feature3.feature contains two Scenarios:

1
2
3
4
5
6
7
8
Feature: Feature3
  Scenario: ScenarioName3
    Then verify myParameter1==1
    Then verify myParameter2=="someValue"
    Then verify myParameter3==false

  Scenario: ScenarioName3a
    Then verify 1==1

The first Scenario failed because the Context Objects verified do not exist.

5. Pass Parameters to Features

Just like the -c/--config command line switch, a single <Config> tag can be used with each test case to pass configuration parameters. Everything within the config tag will be interpreted as an intaQt configuration (.conf) file.

Run the following, in which the parameters verified by Feature3.feature are passed within the <Config> tag:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
<?xml version="1.0" encoding="UTF-8" ?>
<TestSuiteCollection>
    <TestSuite name="TestSuite1">
        <TestCase name="TestCaseClassName">
            <TestScript file="Feature3.feature" workdir="C:/QiTASC/intaqt-cli/bin/absolutePath/F3">
            <Config>ContextObjects {
                                    myParameter1=1,
                                    myParameter2="someValue",
                                    myParameter3=false
                    }
            </Config>
            </TestScript>
        </TestCase>
    </TestSuite>
</TestSuiteCollection>

Run the following once again:

1
./intaqt test HowTo-IntaQtClient intaQtClientConfiguration.xml

Both Scenarios of Feature3 will now pass:

1
2
3
4
5
6
7
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="0" hostname="qvie-thomas"
    name="TestSuite1" tests="2" time="27" timestamp="2018-02-22T14:35:38.232">
    <testcase classname="TestCaseClassName" name="ScenarioName3" time="18"/>
    <testcase classname="TestCaseClassName" name="ScenarioName3a" time="9"/>
    <system-out/>
</testsuite>

5. Define Custom Variables

Run the following, in which custom display variables for JUnit may be specified within the <Variables> tag:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<?xml version="1.0" encoding="UTF-8" ?>
<TestSuiteCollection>
    <TestSuite name="TestSuite1">
        <TestCase name="TestCaseClassName">
            <TestScript file="Feature1.feature" workdir="C:/QiTASC/intaqt-cli/bin/absolutePath/F1"></TestScript>
        </TestCase>
        <Variables>
            <Variable name="Author:" value="Employee of the month"  />
            <Variable name="myVariable:" value="myValue"  />
        </Variables>
    </TestSuite>
</TestSuiteCollection>

Execute the test suite from intaQt Client:

1
./intaqt test HowTo-IntaQtClient intaQtClientConfiguration.xml

The variables can now be seen in the summary's <system-out> section:

1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="0" hostname="qvie"
    name="TestSuite1" tests="1" time="8" timestamp="2018-02-22T14:42:57.641">
    <testcase classname="TestCaseClassName" name="ScenarioName1" time="8"/>
    <system-out>
Author: : Employee of the month
myVariable: : myValue
</system-out>
</testsuite>