Skip to main content

Hyperexecute Yaml Version 0.2


Hyperexecute YAML Version 0.2. This version introduces several new features and improvements compared to Version 0.1. This documentation will guide you through the changes and help you understand when to use Version 0.2 instead of Version 0.1.

Note: Currently we only support maven/testng framework.

Version 0.2 vs. Version 0.1

The following are the key differences between Version 0.2 and Version 0.1:

  • In Version 0.2, the support for matrix mode has been removed, and only static discovery is available. This means that the discovery command will run on your system rather than in a matrix.

  • Version 0.2 supports all the fields available in Version 0.1, except for testDiscovery and testRunnerCommand

  • The new framework field has been introduced to configure the test framework.

framework

The framework field in Hyperexecute YAML Version 0.2 allows you to configure the test framework settings. It provides more flexibility and customization options for your testing needs.

The framework field has following attributes:

ItemDetails
RequiredYes
TypeObject

Example

framework: 
name: maven/testng
defaultReports: false
flags: ["-Dplatname=win"]

The framework field supports the following parameters

ParametersTypeMandatoryDescription
nameStringYesYou need to specify which testing framework you are using in your repo.
flagsArrayNoCommand line flags to pass to the custom runner for both test discovery and execution.
discoveryFlagsArrayNoCommand line flags to pass to the custom runner for test discovery only.
runnerFlagsArrayNoCommand line flags to pass to the custom runner for test execution only.
discoveryTypeStringNoSpecifies the type of test discovery to use. Supported values are "method" and "class". The default is "method".
workingDirectoryStringNoSpecifies the working directory where all discovery and execution commands will be executed.
defaultReportsBooleanNoSpecifies whether to create default reports for the specified framework.

name

Specifies the testing framework used in your repository.

Note: Currently supported frameworks are maven/testng, maven/junit4, maven/junit5, wdio/mocha, and wdio/jasmine framework.

framework:
name: "maven/testng"

To enable maven runner with Appium, you have to pass appium: true before the framework field

appium: true
framework: 
  name: "maven/testng"

flags

Specifies the command line flags to pass to the custom runner for both test discovery and execution.

framework:
name: "maven/testng"
flags: ["-Dplatname=win", "-Dgroups=selenium-test"]

discoveryFlags

Specifies the command line flags to pass to the custom runner for test discovery only.

framework:
name: "maven/testng"
discoveryFlags: ["-Dgroups=selenium-test"]

runnerFlags

Specifies the command line flags to pass to the custom runner for test execution only.

framework:
name: "maven/testng"
runnerFlags: ["-Dgroups=database"]

discoveryType

Specifies the level at which user wants to discover the tests. Supported values are "method" and "class". The default is "method".

framework:
name: maven/testng
discoveryType: method
# instead of method you can also use xmltest or class as a discovery type
flags:
- "-Dplatname=win"
info
  • For maven/testng the supported discovery types are method, class and xmltest. The default is method.

  • For maven/junit4 and maven/junit5 the supported discovery types are method and class. The default is method.

  • For wdio/mocha and wdio/jasmine the supported discovery types are test, spec, suite and wdiosuite. The default is spec.

workingDirectory

The working directory specifies the location of the directory in which all test discovery and execution commands will be run, as well as the location of any files or directories that are created as a result of the command execution. If the workingDirectory option is not specified, then the working directory will be the directory where the YAML file is located.

framework:
name: maven/testng
discoveryType: method
workingDirectory: src/main
flags:
- "-Dplatname=win"

defaultReports

Specifies whether to create default reports for the specified framework.

framework:
name: maven/testng
defaultReports: false
flags:
- "-Dplatname=win"

Sample Yaml Version 0.2

---
version: 0.2
globalTimeout: 150
testSuiteTimeout: 150
testSuiteStep: 150

runson: win

autosplit: true
retryOnFailure: true

maxRetries: 1
concurrency: 5

pre:
# Skip execution of the tests in the pre step
- mvn dependency:resolve

post:
- ls target/surefire-reports/

mergeArtifacts: true


uploadArtefacts:
- name: ExecutionSnapshots
path:
- target/surefire-reports/html/**

framework:
name: maven/testng
defaultReports: false
flags:
- "-Dplatname=win"

Additional Details

Default Caching Support

NOTE: The new framework feature supports caching by default, the user does not need to specify any directories to cache for faster performance.

For example in maven we cache the entire .m2 directory in home folder so that subsequent tasks run faster.

If the user adds the cacheDirectories and cacheKey keys in his yaml, the default caching gets disabled and preference is given to user specified cache.

cacheKey: '{{ checksum "pom.xml" }}'
cacheDirectories:
- .m2

Performing Group-Based Test Discovery in TestNG

TestNG provides group-based test discovery functionality. You can specify groups for your tests and execute or exclude specific groups during test runs.

To perform group-based test discovery, you can use the @BeforeGroups and @AfterGroups annotations in your TestNG tests. These annotations allow you to specify setup and cleanup methods that run before and after specific groups of tests.

For example:

public class GroupIntegrationTest {

@BeforeGroups("database")
public void setupDB() {
System.out.println("setupDB()");
}

@AfterGroups("database")
public void cleanDB() {
System.out.println("cleanDB()");
}

@Test(groups = "selenium-test")
public void runSelenium() {
System.out.println("runSelenium()");
}

@Test(groups = "selenium-test")
public void runSelenium1() {
System.out.println("runSelenium()1");
}

@Test(groups = "database")
public void testConnectOracle() {
System.out.println("testConnectOracle()");
}

@Test(groups = "database")
public void testConnectMsSQL() {
System.out.println("testConnectMsSQL");
}

}

In the Hyperexecute YAML Version 0.2 configuration, you can use the discoveryFlags parameter to specify the groups to discover during test discovery.

framework:
name: "maven/testng"
discoveryFlags: ["-Dgroups=database"]

Here it will only discover tests belonging to the group database. Use comma-separated values if you want to specify multiple groups.

Similarly, you can use the excludedGroups parameter that can be used to run all test groups except for the defined set of groups.

framework:
name: "maven/testng"
discoveryFlags: ["-DexcludedGroups=database"]

This discovers all test of groups except database.

Alternatively, you can also specify the groups or excluded groups directly in the pom.xml file using the Maven Surefire Plugin

<plugins>
[...]
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<groups>database,selenium-test</groups>
</configuration>
</plugin>
[...]
</plugins>

Conclusion

This documentation provides an overview of the Hyperexecute YAML Version 0.2 and its features. We hope this information helps you understand the changes and improvements in Version 0.2 compared to Version 0.1.