File tree Expand file tree Collapse file tree 4 files changed +70
-0
lines changed Expand file tree Collapse file tree 4 files changed +70
-0
lines changed Original file line number Diff line number Diff line change
1
+ # How to upload test results to Qase from the Go tests
2
+
3
+ You can upload test results to Qase from the Go tests.
4
+
5
+ First, you need to install the ` gotestsum ` package. This package is used to run the tests and save the results in the JUnit format.
6
+
7
+ Then you can upload the test results to Qase using the ` qasectl ` tool.
8
+
9
+ Step-by-step guide:
10
+
11
+ 1 . Clone the repository
12
+
13
+ ``` bash
14
+ git clone https://github.com/qase-tms/qase-go.git
15
+ ```
16
+
17
+ 2. Move to the directory with the examples
18
+
19
+ ` ` ` bash
20
+ cd qase-go/examples/go
21
+ ` ` `
22
+
23
+ 3. Install the required packages
24
+
25
+ ` ` ` bash
26
+ go mod tidy
27
+ ` ` `
28
+
29
+ 4. Install the ` gotestsum` package
30
+
31
+ ` ` ` bash
32
+ go install gotest.tools/gotestsum@latest
33
+ ` ` `
34
+
35
+ 5. Run the tests and save the results to the ` test-results.xml` file
36
+
37
+ ` ` ` bash
38
+ gotestsum --junitfile results/test-results.xml
39
+ ` ` `
40
+
41
+ 6. Upload the test results to Qase using the [qasectl](https://github.com/qase-tms/qasectl/blob/main/docs/command.md) tool
42
+
43
+ ` ` ` bash
44
+ qli testops result upload --project DEMO --token token --id 1 --format junit --path /results/test-results.xml --verbose
45
+ ` ` `
Original file line number Diff line number Diff line change
1
+ module examples/go
2
+
3
+ go 1.22.5
Original file line number Diff line number Diff line change
1
+ package _go
2
+
3
+ func Sum (a , b int ) int {
4
+ return a + b
5
+ }
Original file line number Diff line number Diff line change
1
+ package _go
2
+
3
+ import "testing"
4
+
5
+ func Test_SumSuccess (t * testing.T ) {
6
+ result := Sum (1 , 2 )
7
+ if result != 3 {
8
+ t .Errorf ("Sum(1, 2) = %d; want 3" , result )
9
+ }
10
+ }
11
+
12
+ func Test_SumFailed (t * testing.T ) {
13
+ result := Sum (1 , 2 )
14
+ if result != 4 {
15
+ t .Errorf ("Sum(1, 2) = %d; want 4" , result )
16
+ }
17
+ }
You can’t perform that action at this time.
0 commit comments