Microsoft Visual Studio Integration
Since Microsoft Visual Studio 2015, the Squish plugin is replaced with a new Squish library that allows running Squish tests using unit tests. This brings GUI test execution even closer to the AUT.
Obtaining the Visual Studio Integration
The newest Visual Studio Integration library can be downloaded from: https://download.froglogic.com/resources/squish-vs-integration-library_latest.zip.
The Squish Visual Studio Integration package contains:
- SquishTest.dll library
- Example tests project
Usage
The example project implements three unit tests that execute the same test suite in three different configurations. The SquishTest.dll library was added to the project as a reference.
As in UnitTest1.cs
from the provided example, to run a test suite you need to create a SquishRun
object, set the report generators and call the Start()
method.
SquishRun squishRun = new SquishRun(squishPackage, testSuite, htmlDir); // Set the HTML reportgen squishRun.HtmlReport(htmlDir); //Set the Testcenter reportgen squishRun.TestcenterReport(testcenterBaseURL, uploadToken, project, batchName, labels); squishRun.Start(); Assert.IsTrue(squishRun.ExecutionSuccessful, "Test execution failed.\n"+ squishRun.RunnerErrorOutput);
The SquishTest.dll library provides a SquishRun
object whose methods can be used for executing test suites prepared with Squish.
SquishRun SquishRun(squishPackage, testSuite)
SquishRun SquishRun(squishPackage, testSuite, testCases)
SquishRun SquishRun(squishPackage, testSuite, host, port)
SquishRun SquishRun(squishPackage, testSuite, testCases, host, port)
The constructor of the SquishRun
object.
- squishPackage - a Squish installation directory path on a test machine
- testSuite - a test suite path on the test machine
- testCases - an array of test cases to execute, such as the
--testcase test_case_name
option from the command line execution - port - port on which squishserver should be started
- host - host used for remote execution. When used, squishserver needs to be started separately. For example, manually or by a script.
Once the SquishRun
object is created, the following functions and properties become available:
void SquishRun.HtmlReport(htmlDir)
- htmlDir - path to the directory where an HTML report will be created
void SquishRun.TestcenterReport(testcenterBaseUrl, uploadToken, project, batchName, labels)
- testcenterBaseUrl - Base URL of the Testcenter instance to upload to, for example:
http://myserver:8800
- uploadToken - Upload token, created from Squish Test Center user settings. See Squish Test Center documentation for further details.
- project - Name of the project receiving the upload
- batchName - (Optional) Name of the batch. If provided, will be the name of the batch created in the indicated project otherwise a name will be automatically generated
- labels - (Optional) Dictionary of labels keys/values to set on the report. Example:
new Dictionary<string, string>{ {"OS", "Windows"} }
int SquishRun.Start()
The Start
method starts the test execution. It returns the squishrunner exit code. Value 99 means that tests were executed but the results contain a FAIL, ERROR, or FATAL entry.
int SquishRun.TestcenterReportID
This property holds the report ID returned by Squish Test Center reportgen
if the upload was successful. Default value is -1.
boolean SquishRun.ExecutionSuccessful
This property indicates whether the execution was successful, i.e., the results don't contain FAIL, ERROR, or FATAL entries.
© 2024 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners.