A Squash-TA automation project is a maven project so the installation of Maven is a prerequisite to execute tests. (See Install Squash-TA Toolbox)
The 'run' goal (squash-ta:run)
The 'run' goal of the Squash-TA maven plugin (squash-ta:run) permits to execute one or several tests. By default this goal is associated to the 'Integration-test' phase of the maven build life cycle.
To execute ALL tests, you could use one of the command bellow (in directory which contains the pom.xml of your project):
mvn integration-test
mvn squash-ta:run
@Since Squash-TA framework 1.7.0 : Both commands have the same configuration by default. Before TA 1.7.0, "squash-ta:run" launched the Squash TM event callback (Used by the TA server for the TA-TM link) whereas "integration-test" wasn't. Now a property is used to activate the Squash TM event callback (See below).
@Since Squash-TA framework 1.8.0 : the execution produce a json file representing the test tree of the project. More details on this new feature here
Specify the test list to execute
The Squash-TA maven plugin defines a maven property which permits to specify the tests list to execute: 'ta.test.suite'.
It's possible to affect a value to the 'ta.test.suite' property modifying the 'pom.xml' of the automation project.
Example:
…
<modelVersion>4.0.0</modelVersion>
<groupId>fr.mycompany</groupId>
<artifactId>my-app-automated-tests</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<properties>
<ta.test.suite>tc1.txt,tc2.txt</ta.test.suite>
</properties>
<build> …
It's also possible to affect a value to this property via a command line:
Example:
mvn integration-test -Dta.test.suite=tc1.txt,tc2.txt
Note:
If the property is defined in the 'pom.xml' AND via the command line, the command line value primes.
If the property has an empty value, all tests are executed.
There is many ways to define the list of tests to execute through the "ta.test.suite" parameter. More details here
Manage the temporary files (since Squash-TA framework 1.7.0)
The Squash-TA maven plugin also defines two maven properties which permit to manage the temporary files created during the execution.
ta.temp.directory : defines where the temporary files should be put
ta.debug.mode : defines if we should delete these files after the execution or not (its value must be "true" or "false")
It's possible to affect a value to these properties modifying the 'pom.xml' of the automation project.
Example:
…
<modelVersion>4.0.0</modelVersion>
<groupId>fr.mycompany</groupId>
<artifactId>my-app-automated-tests</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<properties>
<ta.temp.directory>C:\Squash_TA_temp</ta.temp.directory>
<ta.debug.mode>true</ta.debug.mode>
</properties>
<build> …
It's also possible to affect a value to these properties via a command line:
Example:
mvn integration-test -Dta.temp.directory=C:\Squash_TA_temp
mvn integration-test -Dta.debug.mode=true
Note:
If a property is defined in the 'pom.xml' AND via the command line, the command line value primes.
If the property ta.temp.directory has an empty value or is not configured, the system temporary directory is used.
If the property ta.debug.mode has an empty value or is not configured, its value is determined as "false" and the files are deleted.
The framework define two goals to retrieve the test list.
The 'list' goal (squash-ta:list) (@since Squash-TA framework 1.8.0)
The 'list' goal generate a json file representing the test tree of the current project. The json file has for name testTree.json and is create in target/squashTA/test-tree directory.
Here is a sample of the produced file:
{
"timestamp" : "2014-06-17T09:48:19.733+0000",
"name" : "tests",
"contents" : [{
"name" : "sample",
"contents" : [{
"name" : "test-OK.ta",
"contents" : null
}
]
}, {
"name" : "sample2",
"contents" : [{
"name" : "placeHolder.ta",
"contents" : null
}, {
"name" : "test-OK.ta",
"contents" : null
}
]
}, {
"name" : "placeHolder.ta",
"contents" : null
}, {
"name" : "test-KO-db-verification.ta",
"contents" : null
}, {
"name" : "test-KO-sahi.ta",
"contents" : null
}, {
"name" : "test-OK.ta",
"contents" : null
}
]
}
The 'test-list' goal (squash-ta:test-list)
The 'test-list' goal of the Squash-Ta maven plugin permits to list entire ecosystems and test cases of the project. To launch the 'test-list' goal on a Squash-TA automation project, the following command must be executed:
mvn squash-ta:test-list
This goal return the test list :
In the console / log
Through the exporters configured in the pom.xml (html, surefire)
Note: The command must be executed in the automation project directory containing the file 'pom.xml'.
@Since Squash-TA framework 1.7.0 a new simplified pom.xml file has been introduce:
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>my.company</groupId>
<artifactId>my-project</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<!-- Properties definition -->
<properties>
<!-- Squash-TA framework version used by the project -->
<ta.framework.version>1.7.0-RELEASE</ta.framework.version>
<!-- Log configuration file -->
<logConfFile>src/log4j.properties</logConfFile> //@since SquashTA framework 1.9.0 the log configuation file path is specified in the launch configuration so this line should be removed
</properties>
<build>
<plugins>
<!-- Configuration of the Squash TA framework used by the project -->
<plugin>
<groupId>org.squashtest.ta</groupId>
<artifactId>squash-ta-maven-plugin</artifactId>
<version>${ta.framework.version}</version>
<!-- Here you can add libraries to the engine classpath, using the <dependencies></dependencies> tag -->
<!-- A sample with the mySql jdbc driver -->
<!-- <dependencies> -->
<!-- <dependency> -->
<!-- <groupId>mysql</groupId> -->
<!-- <artifactId>mysql-connector-java</artifactId> -->
<!-- <version>5.1.19</version> -->
<!-- </dependency> -->
<!-- </dependencies> -->
<!-- Under here is the Squash TA framework default configuration -->
<!-- Under here is the Squash TA framework default configuration -->
<configuration>
<!-- Uncomment the line below in order to the build finish in success even if a test failed -->
<!-- <alwaysSuccess>true</alwaysSuccess> -->
<!-- Define a log configuration file (at log4j format) to override the one defined internally -->
<!-- If the given file can't be found the engine switch to the internal configuration-->
<logConfiguration>${logConfFile}</logConfiguration>
<!-- Define exporters -->
<exporters>
<surefire>
<jenkinsAttachmentMode>${ta.jenkins.attachment.mode}</jenkinsAttachmentMode>
</surefire>
<html/>
</exporters>
<!-- Define configurers -->
<configurers>
<tmCallBack>
<endpointURL>${status.update.events.url}</endpointURL>
<executionExternalId>${squash.ta.external.id}</executionExternalId>
<jobName>${jobname}</jobName>
<hostName>${hostname}</hostName>
<endpointLoginConfFile>${squash.ta.conf.file}</endpointLoginConfFile>
<reportBaseUrl>${ta.tmcallback.reportbaseurl}</reportBaseUrl> //@since SquashTA framework 1.8.0
<jobExecutionId>${ta.tmcallback.jobexecutionid}</jobExecutionId> //@since SquashTA framework 1.8.0
<reportName>${ta.tmcallback.reportname}</reportName> //@since SquashTA framework 1.8.0
</tmCallBack>
</configurers>
</configuration>
<!-- Bind the Squash TA "run" goal to the maven integration-test phase and reuse the default configuration -->
<executions>
<execution>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- Squash TA maven repository -->
<repositories>
<repository>
<id>org.squashtest.ta.release</id>
<name>squashtest test automation - releases</name>
<url>http://repo.squashtest.org/maven2/releases</url>
</repository>
</repositories>
<!-- Squash TA maven plugin repository -->
<pluginRepositories>
<pluginRepository>
<id>org.squashtest.plugins.release</id>
<name>squashtest.org</name>
<url>http://repo.squashtest.org/maven2/releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</project>
By default, in this simplified version, the following configuration has been set:
Generation of a html report at the end of the execution
Generation of the Junit reports at the end of execution with attachment and jenkinsAttachmentMode deactivate
The Squash-TM events callback for the Squash TA-TM link is declared but deactivated
For Squash TA framework 1.6.0 the default configuration was:
goal integration-test
Generation of a html report at the end of the execution
goal squash-ta:run
Generation of a html report at the end of the execution
Generation of the Junit reports at the end of execution with attachment and jenkinsAttachmentMode activated
The Squash-TM events callback for the Squash TA-TM link is declared and activated
For Squash TA framework before 1.6.0 the default configuration was:
goal integration-test
Generation of the Junit reports at the end of the execution with attachment and jenkinsAttachmentMode deactivated
goal squash-ta:run
Generation of the Junit reports at the end of the execution with attachment and jenkinsAttachmentMode activated
The Squash-TM events callback for the Squash TA-TM link is declared and activated
<exporters>
For more information on the Squash-TA exporters configuration, please read this
<configurer>
Currently, there is only one configurer existing in Squash-TA. It used to configure the Squash-TM events callback for the TA - TM link. When activated, this component send progression events to Squash-TM during the execution of a test suite. If you don't use the TA-TM link, then you don't need this configurer.
To declare the Squash-TM events callback in your project :
<configuration>
...
<configurers>
<configurer implementation="org.squashtest.ta.link.SquashTMCallbackEventConfigurer">
<endpointURL>${status.update.events.url}</endpointURL>
<executionExternalId>${squash.ta.external.id}</executionExternalId>
<jobName>${jobname}</jobName>
<hostName>${hostname}</hostName>
<endpointLoginConfFile>${squash.ta.conf.file}</endpointLoginConfFile>
<!-- @since Squash-TA framework 1.8.0 -->
<reportBaseUrl>${ta.tmcallback.reportbaseurl}</reportBaseUrl>
<jobExecutionId>${ta.tmcallback.jobexecutionid}</jobExecutionId>
<reportName>${ta.tmcallback.reportname}</reportName>
</configurer>
</configurers>
...
</configuration>
@since Squash-TA framework 1.7.0 there is a simpler solution
<configuration>
...
<configurers>
<tmCallBack>
<endpointURL>${status.update.events.url}</endpointURL>
<executionExternalId>${squash.ta.external.id}</executionExternalId
<jobName>${jobname}</jobName>
<hostName>${hostname}</hostName>
<endpointLoginConfFile>${squash.ta.conf.file}</endpointLoginConfFile>
<!-- @since Squash-TA framework 1.8.0 -->
<reportBaseUrl>${ta.tmcallback.reportbaseurl}</reportBaseUrl>
<jobExecutionId>${ta.tmcallback.jobexecutionid}</jobExecutionId>
<reportName>${ta.tmcallback.reportname}</reportName>
</tmCallBack>
</configurers>
...
</configuration>
@Since Squash-TA framework 1.8.0, there is three new parameters for the tmCallBack configurer:
<reportBaseUrl>${ta.tmcallback.reportbaseurl}</reportBaseUrl>
<jobExecutionId>${ta.tmcallback.jobexecutionid}</jobExecutionId>
<reportName>${ta.tmcallback.reportname}</reportName>
Note :
@Since Squash-TA framework 1.7.0, the endpointURL as a default value: file://dev/null. Moreover this default value has for effect to deactivate the send event mecanism; A valid URL should be given to activate it.
If you have installed the Squash-TA Toolbox and that you are using Squash-TA Eclipse, go to 'Run/Run configurations' :
And there you have the pre-installed maven run configurations:
@Since Squash-TA toolbox 1.9.0, there is three sets of run configuration:
One set which use the goal "squash-ta:run" to run the test and specify location of lo4j configuration file "-Dlog4j.configurationFile=log4j2.xml"
Run all tests
Run selected test(s)
Run test list
One set which use the maven lifecycle "squash-ta:run" to run the test
(Before TA fwk 1.9.0) Run all tests
(Before TA fwk 1.9.0) Run selected test(s)
(Before TA fwk 1.9.0) Run test list
One set which use the maven lifecycle "integration-test" to run the test
(Before TA fwk 1.7.0) Run all tests
(Before TA fwk 1.7.0) Run selected test(s)
(Before TA fwk 1.7.0) Run test list
@Since Squash-TA toolbox 1.7.0, there is two sets of run configuration:
One set which use the goal "squash-ta:run" to run the test.
Run all tests
Run selected test(s)
Run test list
One set which use the maven lifecycle "integration-test" to run the test
(Before TA fwk 1.7.0) Run all tests
(Before TA fwk 1.7.0) Run selected test(s)
(Before TA fwk 1.7.0) Run test list
Before Squash-TA toolbox 1.7.0 there was only three run configurations which used the maven lifecycle "integration-test" to run test. But as TA server use the goal "squash-ta:run" to run the test, for the sake of consistency we decided to use it also as the default way to run test in the toolbox. So we have create three new run configurations which replace the previous one and we have rename the previous one by prefixed them with: (Before TA fwk 1.7.0)
Note:
To run project which uses Squash-TA framework until 1.6.0 version under Squash-TA toolbox 1.7.0, the prefixed run configuration should be used.