For AI agents and LLMs: a machine-readable index is available at llms.txt. A plain-Markdown version of any documentation page is available by appending .md to its URL.
Skip to main content

HyperExecute TestNG Use Cases

This guide covers common language-specific use cases for running tests on HyperExecute, organized by framework: Java + TestNG, Python, and C#.

TestNG Use Cases​

This guide outlines common Java + TestNG scenarios for running tests on HyperExecute

Q: How can I ensure my tests operate with the appropriate Java version on HyperExecute?​

By default, HyperExecute VMs are provisioned with Java 8. If your project requires another version (e.g., 11, 15, 18, 22), you can use the runtime feature and specify the compatible version in the hyperexecute.yaml.

YAML Example for Java 11

Verified
hyperexecute.yaml
runtime:
language: java
version: "11"

Q: What is test discovery in HyperExecute, and how does it help?​

Test discovery is the process of pre-identifying the tests (classes, scenarios, or feature files) to be executed.

Why Use Test Discovery?​

  • Selective Execution → Run only the tests you need.
  • Flexibility → Filter by file paths, tags, or custom logic.
  • Pre-Execution Preview → Know exactly which tests will run.

Discovery Methods​

TypeDescriptionUse Case
rawRuns a shell command to list tests.Simple, filename/class-based filtering.
automaticUses HyperExecute backend tools (snooper) for discovery.Tag or scenario-based filtering.

Examples​

Automatic Discovery (Tag-based)

Verified
hyperexecute.yaml
testDiscovery:
type: automatic
mode: static
args:
featureFilePaths: web/src/test/resources/features
frameWork: java
specificTags: ["@AccountCombineSet"]

Raw Command Discovery

Verified
hyperexecute.yaml
testDiscovery:
type: raw
mode: local
command: grep 'public class' src/test/java/hyperexecute/*.java | awk '{print $3}'

Discovery Modes​

  • local → Runs discovery on your machine (useful for small/simple projects).
  • remote → Runs discovery on HyperExecute VM (recommended for large projects).

Q: How do I include/exclude tests using tags?​

You can pass logical tag expressions in testDiscovery or use the ignoredTags parameter.

Example: Logical Tag Filtering

Verified
hyperexecute.yaml
testDiscovery:
command: .hyperexecute/snooper --targetOs=win \
--featureFilePaths=web/src/test/resources/features \
--frameWork=java \
--query="@UAT2Miniregression and not @FLNAUAT2" \
| awk '{gsub("web/", ""); print}'
mode: static
type: raw

Example: Ignored Tags

Verified
ignoredTags: ["@tag3", "@tag2"]

Q: How do I configure the runner command for different Cucumber versions?​

Cucumber VersionRunner Command Example
v6 and belowmvn test -Dcucumber.options="$test"
v7 and abovemvn test -Dcucumber.features="$test"

Q: What if my project has multiple Maven modules?​

In projects with modules (web, api, mobile), discovered test paths may include the module prefix (e.g., web/), causing mismatches.

Solution : Use awk to strip module prefixes from discovered test paths.

Verified
hyperexecute.yaml
testDiscovery:
command: .hyperexecute/snooper --targetOs=win \
--featureFilePaths=web/src/test/resources/features \
--frameWork=java \
--specificTags=@AccountCombineSet \
| awk '{gsub("web/", ""); print}'
mode: static
type: raw

Q: How should I configure testng.xml when I have multiple runners?​

To avoid duplicate executions:

  • Use one runner class in testng.xml.
  • Comment out tags in @CucumberOptions.
  • Let HyperExecute discovery handle filtering.

Example: testng.xml

Verified
testng.xml
<suite name="Sanity Suite">
<test name="Test">
<classes>
<class name="com.qt.sid.bdd.Runner.RunnerSanity.TestRunnerUK"/>
</classes>
</test>
</suite>

Example: @CucumberOptions

Verified
@CucumberOptions(
features = "src/test/resources/features",
// tags = "@Regression and not @ignore", // Commented out
glue = "com/qt/sid/stepdefinitions",
plugin = {
"pretty",
"html:test-output/cucumber-reports/html-report.html",
"json:test-output/cucumber-reports/json-report.json",
"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:",
"json:target/cucumber.json"
},
monochrome = true
)

Discovery YAML Example

Verified
hyperexecute.yaml
testDiscovery:
type: automatic
mode: static
args:
featureFilePaths: src/test/resources/features/SanitySuite
frameWork: java
specificTags: ["@Regression"]

Q: What if my Allure reports/screenshots are too large to render on the dashboard?​

Large reports may fail to render in HyperExecute dashboard. It is recommended to generate zipped Allure reports for local viewing.

YAML Example

Verified
hyperexecute.yaml
report: true
partialReports:
location: allure-results/webapp
type: zip
frameworkName: allure-zip

To view Locally

  • Install Allure
Verified
brew install allure
  • Open report
Verified
allure open ./pathDirectory   # Replace pathDirectory with the actual report folder.

Terminal First Testing With Kane CLI

Natural language browser & mobile app tests right from terminal.

×
Schedule Your Personal Demo
Kane CLI terminal

Help and Support

Related Articles