-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test examples and instruction on how to upload test results to the Qase
- Loading branch information
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# How to upload test results to Qase from the Go tests | ||
|
||
You can upload test results to Qase from the Go tests. | ||
|
||
First, you need to install the `gotestsum` package. This package is used to run the tests and save the results in the JUnit format. | ||
|
||
Then you can upload the test results to Qase using the `qasectl` tool. | ||
|
||
Step-by-step guide: | ||
|
||
1. Clone the repository | ||
|
||
```bash | ||
git clone https://github.com/qase-tms/qase-go.git | ||
``` | ||
|
||
2. Move to the directory with the examples | ||
|
||
```bash | ||
cd qase-go/examples/go | ||
``` | ||
|
||
3. Install the required packages | ||
|
||
```bash | ||
go mod tidy | ||
``` | ||
|
||
4. Install the `gotestsum` package | ||
|
||
```bash | ||
go install gotest.tools/gotestsum@latest | ||
``` | ||
|
||
5. Run the tests and save the results to the `test-results.xml` file | ||
|
||
```bash | ||
gotestsum --junitfile results/test-results.xml | ||
``` | ||
|
||
6. Upload the test results to Qase using the [qasectl](https://github.com/qase-tms/qasectl/blob/main/docs/command.md) tool | ||
|
||
```bash | ||
qli testops result upload --project DEMO --token token --id 1 --format junit --path /results/test-results.xml --verbose | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module examples/go | ||
|
||
go 1.22.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package _go | ||
|
||
func Sum(a, b int) int { | ||
return a + b | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package _go | ||
|
||
import "testing" | ||
|
||
func Test_SumSuccess(t *testing.T) { | ||
result := Sum(1, 2) | ||
if result != 3 { | ||
t.Errorf("Sum(1, 2) = %d; want 3", result) | ||
} | ||
} | ||
|
||
func Test_SumFailed(t *testing.T) { | ||
result := Sum(1, 2) | ||
if result != 4 { | ||
t.Errorf("Sum(1, 2) = %d; want 4", result) | ||
} | ||
} |