Skip to content

Commit cf3f0de

Browse files
authored
Merge pull request #1408 from surishubham/main
Stage PR 1399, 1407
2 parents 7e54102 + 8496ff8 commit cf3f0de

File tree

2 files changed

+78
-2
lines changed

2 files changed

+78
-2
lines changed

docs/deep-dive-into-hyperexecute-yaml.md

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,16 @@ matrix:
7272
***
7373

7474
### `pre`
75-
All actions you need to perform before test execution, such as installing dependencies. You’ll ideally want to use this parameter to "pre" run simple commands like `npm install`, `yarn install`, `mvn install` etc
75+
All actions you need to perform before each test execution, such as installing dependencies. You’ll ideally want to use this parameter to "pre" run simple commands like `npm install`, `yarn install`, `mvn install` etc
7676

7777
```yaml
7878
pre:
7979
- npm install
8080
- mvn install
8181
```
8282

83+
>📘 Refer to [globalPre](/support/docs/deep-dive-into-hyperexecute-yaml/#globalpre) command to perform a common global setup for all your tasks, such as installing dependencies or configuring environments.
84+
8385
***
8486
## AutoSplit Mode Parameters
8587

@@ -482,14 +484,16 @@ maxRetries: 2
482484
***
483485

484486
### `post`
485-
This parameter is used for executing actions after all your tests are executed, such as printing an output file or uploading a report via a curl API request. It's ideal for performing post-run tasks.
487+
This parameter is used for executing actions after every test execution, such as printing an output file or uploading a report via a curl API request. It's ideal for performing post-run tasks.
486488

487489
```yaml
488490
post:
489491
- echo <some-dir>/output/output.log
490492
- curl https://www.example.com
491493
```
492494

495+
>📘 Refer to [globalPost](/support/docs/deep-dive-into-hyperexecute-yaml/#globalpost) command to perform a common global setup for all your tasks, such as clean up tasks and or killing the environments.
496+
493497
***
494498

495499
### `report`
@@ -617,6 +621,76 @@ The uploadArtefact flag is not currently supported for tests running with the **
617621

618622
***
619623

624+
### `globalPre`
625+
> Currently, only **Linux OS** is supported
626+
627+
The `globalPre` flag allows you to define a pre-execution step that runs once before any of your tasks starts. This flag ensures that all necessary setup tasks, such as installing dependencies, configuring environments, or initializing resources, are completed before test execution begins.
628+
629+
#### Functionality
630+
- Runs before any test execution starts, ensuring the environment is properly configured.
631+
- Executes on a separate machine (VM) or the local machine, based on the [test discovery mode](/support/docs/deep-dive-into-hyperexecute-yaml/#mode) selected.
632+
- Useful for setup tasks, such as fetching credentials, initializing databases, or downloading required files.
633+
634+
```yaml title="hyperexecute.yaml"
635+
globalPre:
636+
mode: remote #local or remote
637+
commands:
638+
- "echo 'Setting up environment'"
639+
- "apt-get update && apt-get install -y curl"
640+
- "curl -X POST https://api.example.com/init"
641+
```
642+
643+
#### Parameters
644+
| Parameter | Type | Description |
645+
|-----------|------|-------------|
646+
| mode | string | Defines where the pre-step commands will be executed. <br /> Options: [local or remote](/support/docs/deep-dive-into-hyperexecute-yaml/#mode). |
647+
| commands | list | List of shell commands to execute before test execution begins. |
648+
649+
#### Difference between `globalPre` and `pre` flags
650+
| Scenario | globalPre | pre |
651+
|----------|-----------|-----|
652+
|Purpose | Global setup (e.g., install dependencies, initialize environment) | Task-specific setup (e.g., prepare test data) |
653+
|Execution Frequency | Executes once per entire test execution | Executes once per task |
654+
|Execution Location | Separate VM or local machine | Inside the task environment |
655+
|Example Usage | `apt-get update`, `docker pull` | `export ENV=staging` |
656+
657+
***
658+
659+
### `globalPost`
660+
> Currently, only **Linux OS** is supported
661+
662+
The `globalPost` flag defines a post-execution step that runs once after all tasks have completed. This step ensures that cleanup tasks, such as removing temporary files, logging results, or notifying external systems, are performed after test execution.
663+
664+
#### Functionality
665+
- Runs after all test execution is completed, ensuring final cleanup and reporting.
666+
- Executes on a separate machine (VM) or the local machine, based on the mode selected.
667+
- Useful for cleanup tasks, such as deleting test artifacts, summarizing reports, or deallocating cloud resources.
668+
669+
```yaml title="hyperexecute.yaml"
670+
globalPost:
671+
mode: remote #local or remote
672+
commands:
673+
- "echo 'Cleaning up test environment'"
674+
- "rm -rf /tmp/test-results"
675+
- "curl -X POST https://api.example.com/cleanup"
676+
```
677+
678+
#### Parameters
679+
| Parameter | Type | Description |
680+
|-----------|------|-------------|
681+
| mode | string | Defines where the post-step commands will be executed. <br /> Options: [local or remote](/support/docs/deep-dive-into-hyperexecute-yaml/#mode). |
682+
| commands | list | List of shell commands to execute after test execution completes. |
683+
684+
#### Difference between `globalPost` and `post` flags
685+
| Scenario | globalPost | post |
686+
|----------|------------|------|
687+
|Purpose | Global cleanup (e.g., remove logs, finalize reports) | Task-specific cleanup (e.g., delete temporary files) |
688+
|Execution Frequency | Executes once after all tasks complete | Executes once per task |
689+
|Execution Location | Separate VM or local machine | Inside the task environment |
690+
|Example Usage | `rm -rf /logs`, `curl -X POST …` | `rm -rf temp/*` |
691+
692+
***
693+
620694
### `captureScreenRecordingForScenarios`
621695
If this key is set to true, it will record whole scenario execution, and then video is accessible from your HyperExecute dashboard.
622696
This can be majorly used for non selenium based tests to have the recorded video of the whole scenario.

docs/hyperexecute-yaml-parameters.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ The **HyperExecute YAML** file serves as the foundational component for test exe
131131

132132
| Key | Type | Description|
133133
|-----|------|------------|
134+
| [globalPre](/support/docs/deep-dive-into-hyperexecute-yaml/#globalpre) | Map | This flag runs once before all tasks start, used for global setup such as installing dependencies or configuring environments. |
135+
| [globalPost](/support/docs/deep-dive-into-hyperexecute-yaml/#globalpost) | Map | This flag runs once after all tasks finish, used for global cleanup such as removing logs or finalizing reports. |
134136
| [failFast](/support/docs/deep-dive-into-hyperexecute-yaml/#failfast) | Map | Flag to fail a job faster if there are `x` consecutive failures. |
135137
| [differentialUpload](/support/docs/deep-dive-into-hyperexecute-yaml/#differentialupload) | Map | Minimize the time of upload of code. |
136138
| [background](/support/docs/deep-dive-into-hyperexecute-yaml/#background) | Map |It is used to trigger long-running Application Servers tasks like running WebApps or databases |

0 commit comments

Comments
 (0)