id | title | hide_title | sidebar_label | description | keywords | url | site_name | slug | |||
---|---|---|---|---|---|---|---|---|---|---|---|
hyperexecute-snooper |
Using Snooper on Hyperexecute |
true |
Using Snooper on Hyperexecute |
Learn more about Using Snooper on Hyperexecute |
|
Using Snooper on Hyperexecute |
hyperexecute-snooper/ |
A snooper
is a command that can be used to discover the list of Feature file scenarios that would be further executed using the value passed in the testRunnerCommand
. The snooper
command takes two arguments:
-
featureFilePaths
: This argument specifies the path to the Feature files that you want to discover. -
frameWork
: This argument specifies the framework that you are using for your tests.
For example, the following command will discover the list of Feature file scenarios in the features folder that are using the Java framework:
snooper --featureFilePaths=features/ --frameWork=java
To implement the snooper
command on HyperExecute, we simply need to update our YAML file's testDiscovery
and testRunnerCommand
parameters.
-
The project must be integrated with the LambdaTest grid.
-
Download or Clone the Sample Project.
:::tip Sample repo All the code samples in this documentation can be found on LambdaTest's Github Repository. You can either download or clone the repository to quickly run your tests. <img loading="lazy" src={require('../assets/images/icons/github.png').default} alt="Image" className="doc_img"/> View on GitHub :::
Follow the steps here to implement the above Sample Project Test on HyperExecute using Cucumber.
You can download the HyperExecute CLI
for your OS from the links given below :
This command helps to discover all the test scenarios within the project.
It offers two methods to implement it:
In this method, tests are discovered on the user's machine. The user needs to configure the appropriate parameters, and the command will be executed automatically with the appropriate parameters.
testDiscovery:
type: automatic
mode: static
args:
featureFilePaths: src/test/java/Features/
frameWork: java
specificTags: [""]
The user needs to configure the following parameters as per their requirements:
featureFilePaths
: Path where all feature files are locatedframeWork
: Framework of TestingspecificTags
: (optional) Tags that need to be tested
In this method, tests are discovered on the user's machine. The user needs to provide a command
and appropriate tags that will be executed.
testDiscovery:
type: raw
mode: static
command: snooper --targetOs=win --featureFilePaths=src/test/java/Features/ --frameWork=java --specificTags=@tag1,@tag2
The user needs to configure the following parameters as per their requirements:
command
: It is a mandatory parameter in the yaml file and would throw an error if not found by the compiler.
This command helps to execute the test cases and needs a command that will help to execute the single test. It is executed on the Hyperexecute VMs for each scenario at an individual level.
There are two methods to execute the runner command for cucumber:
testRunnerCommand: mvn test -Dcucumber.options="$test"
-Dcucumber.options
: This parameter is used to specify the feature that will help execute on VMs.
Note: This flag is applicable for cucumber version 7 and above only.
testRunnerCommand: mvn test -Dcucumber.features="$test"
-Dcucumber.features
: This parameter is used to execute one single feature file.
We can also debug testDiscovery
using snooper
to check whether all the desired test scenarios have been discovered or not. This can be implemented using the Snooper CLI binary present in the .hyperexecute folder.
To debug the discovery of the snooper, configure the following command as per the desired parameters:
.hyperexecute/snooper --targetOs=win --ignoredTags=@ignore @skipDaily --featureFilePaths=src/test/java/Features --frameWork=java | sed 's/:.*//' | uniq
Note: .hyperexecute and snooper binary are created only after first execution of the yaml file.
- Snooper discovery can be customized where you can use set of tags that you want to discover the tests.
specificTags: ["@tag1","@tag2"]
- Discovery can also be customized by passing logical query in the snooper using
query
tag:
query: ["((@tag1 or @tag2) and not @tag3)"]
- You can also skip the tests that have some specific tags using
ignoredTags
:
ignoredTags : ["@tag3","@tag2"]
Here is a sample HyperExecute file with cucumber 7 and above to discover all the feature files without any tags.
version: 0.1
globalTimeout: 90
testSuiteTimeout: 90
testSuiteStep: 90
runson: win
autosplit: true
retryOnFailure: true
maxRetries: 1
concurrency: 4
env:
CACHE_DIR: m2_cache_dir
cacheKey: '{{ checksum "pom.xml" }}'
cacheDirectories:
- ${CACHE_DIR}
pre:
- mvn -Dmaven.repo.local=${CACHE_DIR} -Dmaven.test.skip=true clean install
mergeArtifacts: true
uploadArtefacts:
- name: XmlReports
path:
- target/surefire-reports/testng-results.xml
- name: JsonReports
path:
- target/cucumber-reports/CucumberTestReport.json
testDiscovery:
type: automatic
mode: static
args:
featureFilePaths: src/test/java/Features
frameWork: java
testRunnerCommand: mvn test -Dcucumber.features="$test"