You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: test/README.md
+16-4
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,9 @@ The API tests are intended to provide a comprehensive verification of the devfil
16
16
-`test-xxxxxxx.json` : these files are the top level json files, they define the schema to verify and the test files to run.
17
17
-`xxxxxx-tests.json` : these are the test files which contain individual tests which provide the yaml snippets to combine and the expected result.
18
18
19
-
## Running tests
19
+
## Running tests locally
20
20
21
-
from the test/go/src/test directory run
21
+
From the `test/v200/schemaTest` directory run
22
22
-`go test -v`
23
23
24
24
The test will read each of the test-xxxxxx.json files and run the tests defined within. The generated .yaml files used for the tests are created in a `tmp/test-xxxxxx/` directory. These files are not deleted when the test finishes so they can be used to assess any errors, however they will be deleted by a subsequent run of the test. Running the test with the -v option ensures you see a full list of passes and failures.
@@ -57,14 +57,26 @@ A new test approach, shared with the library repository for testing valid devfil
57
57
-`test/v200/utils/common/*-utils.go` : utilites, used by the test, which are also used by the library tests. Mostly contain the code to generate valid devfile content.
58
58
59
59
60
-
## Running tests
60
+
## Running tests locally
61
61
62
62
from the `test/v200/apiTest/` directory run
63
63
-`go test -v`
64
64
65
-
* The test will generate a set of valid devfile.yaml files in `test/v200/apiTest/tmp/api-test/
65
+
* The test will generate a set of valid devfile.yaml files in `test/v200/apiTest/tmp/api-test/`
66
66
* The test will generate a log file: `test/v200/apiTest/tmp/test.log`
67
67
* Each run of the test removes the `test/v200/apiTest/tmp` directory from the previous run.
68
68
69
+
# Run test coverage analysis and reporting locally
69
70
71
+
This is useful to determine if there are any gaps in testing. Run these steps at the root directory `/api` to get a report of all the overall tests, including the ones for api and schema
70
72
73
+
-`go test -coverprofile test/v200/api-test-coverage.out -v ./...`
The tests run automatically with every PR or Push action. You can see the results in the `devfile/api` repo's `Actions` view:
79
+
80
+
1. Select the `CI` workflow and click on the PR you're interested in
81
+
1. To view the console output, select the `build-and-validate` job and expand the `Run Go Tests` step. This will give you a summary of the tests that were executed and their respective status
82
+
1. To view the test coverage report, click on the `Summary` page and you should see an `Artifacts` section with the `api-test-coverage-html` file available for download.
0 commit comments