diff --git a/docs/docs/cli/running-tests.md b/docs/docs/cli/running-tests.md index c0ccf7f9cb..62580e3cbb 100644 --- a/docs/docs/cli/running-tests.md +++ b/docs/docs/cli/running-tests.md @@ -198,15 +198,23 @@ We can run a test and specify that environment with this command: tracetest test run -d path/to/test.yaml -e testenv -w ``` -You can also reference an .env file which will be used to create a new environment or update an existing one. For example, if you have a .env file named local.env with this content: -``` -POKEID=45 -POKENAME=vileplume +You can also reference an environment resource file which will be used to create a new environment or update an existing one. For example, if you have a file named local.env with this content: +``` +type: Environment +spec: + id: local.env + name: local.env + values: + - key: POKEID + value: 45 + - key: POKENAME + value: vileplume ``` + ``` tracetest test run -d path/to/test.yaml -e path/to/local.env -w ``` -If you use the .env approach, a new environment will be created in Tracetest. If it does not exist, the environment name and id will be the file name without the suffix .env. So, local.env becomes local. +If you use the environment resource approach, a new environment will be created in Tracetest. -The second approach is very useful if you are running tests from a CI pipeline. \ No newline at end of file +The second approach is very useful if you are running tests from a CI pipeline. diff --git a/docs/docs/concepts/environments.md b/docs/docs/concepts/environments.md index b301447941..f7407657d3 100644 --- a/docs/docs/concepts/environments.md +++ b/docs/docs/concepts/environments.md @@ -6,22 +6,43 @@ A common use case for tests is to assert the same behavior across multiple envir Environments are objects containing variables that can be referenced by tests. You can use a single test and provide the information on which environment object will be used to run the test. To illustrate this, consider an app that is deployed in three stages: `dev`, `staging`, and `production`. We can execute the same test in all those environments, however, both `URL` and `credentials` change from environment to environment. To run the same test against the three deployments of the app, you can create three environments: -```dotenv +```yaml # dev.env -URL=https://app-dev.com -API_TOKEN=dev-key +type: Environment +spec: + name: dev.env + id: dev.env + values: + - key: URL + value: https://app-dev.com + - key: API_TOKEN + value: dev-key ``` -```dotenv +```yaml # staging.env -URL=https://app-staging.com -API_TOKEN=staging-key +type: Environment +spec: + name: staging.env + id: staging.env + values: + - key: URL + value: https://app-staging.com + - key: API_TOKEN + value: staging-key ``` -```dotenv +```yaml # production.env -URL=https://app-prod.com -API_TOKEN=prod-key +type: Environment +spec: + name: production.env + id: production.env + values: + - key: URL + value: https://app-prod.com + - key: API_TOKEN + value: prod-key ``` Now consider the following test: diff --git a/docs/docs/concepts/transactions.md b/docs/docs/concepts/transactions.md index e714321dde..a06e70b9fd 100644 --- a/docs/docs/concepts/transactions.md +++ b/docs/docs/concepts/transactions.md @@ -57,4 +57,4 @@ Result: **FAILED** * Step 2 (Finished) * Step 3 (Finished) -Result: **FINISHED** \ No newline at end of file +Result: **FINISHED**