Skip to content

Commit 889b0ca

Browse files
authored
Add initial commit (#1)
* Add initial commit * Add basic editor config, makefile, github workflow * Create basic package to create qasphere csv files and add tests * Minor fixes * Add example and readme
1 parent cccb8e4 commit 889b0ca

File tree

10 files changed

+781
-12
lines changed

10 files changed

+781
-12
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Editor configuration, see http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = tab
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
pull_request:
7+
types: [opened, synchronize]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
timeout-minutes: 15
13+
runs-on: ubuntu-latest
14+
15+
env:
16+
CI: true
17+
18+
steps:
19+
- name: Check out code
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 2
23+
24+
- uses: actions/setup-go@v5
25+
with:
26+
go-version: '^1.23.4'
27+
- run: go version
28+
29+
- name: Install gofumpt
30+
run: go install mvdan.cc/gofumpt@latest
31+
32+
- name: Add gofumpt to PATH
33+
run: echo "$GOPATH/bin" >> $GITHUB_PATH
34+
35+
- name: Run gofumpt
36+
run: diff <(echo -n) <(gofumpt -d .)
37+
38+
- name: golangci-lint
39+
uses: golangci/golangci-lint-action@v6
40+
with:
41+
version: v1.62.2
42+
args: --verbose --timeout=3m
43+
44+
- name: Test
45+
run: make test

.gitignore

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# If you prefer the allow list template instead of the deny list, see community template:
2-
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3-
#
41
# Binaries for programs and plugins
52
*.exe
63
*.exe~
@@ -14,12 +11,5 @@
1411
# Output of the go coverage tool, specifically when used with LiteIDE
1512
*.out
1613

17-
# Dependency directories (remove the comment below to include it)
18-
# vendor/
19-
20-
# Go workspace file
21-
go.work
22-
go.work.sum
23-
24-
# env file
14+
# .env files
2515
.env

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
GOCMD=GO111MODULE=on go
2+
3+
linters-install:
4+
@golangci-lint --version >/dev/null 2>&1 || { \
5+
echo "installing linting tools..."; \
6+
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.62.2; \
7+
}
8+
9+
lint: linters-install
10+
golangci-lint run
11+
12+
test:
13+
$(GOCMD) test -v -cover -race ./...
14+
15+
.PHONY: test lint linters-install

README.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,57 @@
11
# qasphere-csv
2-
Library to write QA Sphere CSV files with test cases
2+
3+
The `qasphere-csv` Go library simplifies the creation of CSV files for importing test cases into the [QA Sphere](https://qasphere.com/) Test Management System.
4+
5+
## Features
6+
7+
- Programmatically create large projects instead of manual entries.
8+
- Facilitate migration from older test management systems by converting exported data into QA Sphere's CSV format.
9+
- Includes in-built validations to ensure CSV files meet QA Sphere's requirements for smooth import.
10+
11+
## How to Use
12+
13+
### Starting from Scratch
14+
15+
Clone the repository and explore the [basic example](examples/basic/main.go). Modify the code to add your test cases and run:
16+
17+
```bash
18+
go run examples/basic/main.go
19+
```
20+
21+
Use the `WriteCSVToFile()` method to write directly to a file.
22+
23+
### Integrating into an Existing Project
24+
25+
To include `qasphere-csv` in your Go project, run:
26+
27+
```bash
28+
go get github.com/hypersequent/qasphere-csv
29+
```
30+
31+
Import the library in your Go project:
32+
33+
```go
34+
import qascsv "github.com/hypersequent/qasphere-csv"
35+
```
36+
37+
Refer to the [basic example](examples/basic/main.go) for API usage.
38+
39+
## Importing Test Cases on QA Sphere
40+
41+
1. Create a new Project, if not already done.
42+
2. Open the project from the **Dashboard** and navigate to the **Test Cases** tab.
43+
3. Select the **Import** option from the dropdown in the top right.
44+
45+
For more details, please check the [documentation](https://docs.qasphere.com/).
46+
47+
## Contributing
48+
49+
We welcome contributions! If you have a feature request, encounter a problem, or have questions, please [create a new issue](https://github.com/Hypersequent/qasphere-csv/issues/new/choose). You can also contribute by opening a pull request.
50+
51+
Before submitting a pull request, please ensure:
52+
1. Appropriate unit tests are added and existing tests pass - `make test`
53+
2. Lint checks pass - `make lint`
54+
55+
## License
56+
57+
This library is available under the MIT License. For more details, please see the [LICENSE](license) file.

examples/basic/main.go

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"log"
6+
7+
qascsv "github.com/hypersequent/qasphere-csv"
8+
)
9+
10+
func main() {
11+
// Create a new instance of QASphereCSV
12+
qasCSV := qascsv.NewQASphereCSV()
13+
14+
// Add a single test case
15+
if err := qasCSV.AddTestCase(qascsv.TestCase{
16+
Title: "Changing to corresponding cursor after hovering the element",
17+
Folder: []string{"Bistro Delivery", "About Us"},
18+
Priority: "low",
19+
Tags: []string{"About Us", "Checklist", "REQ-4", "UI"},
20+
Preconditions: "The \"About Us\" page is opened",
21+
Steps: []qascsv.Step{{
22+
Action: "Test the display across various screen sizes (desktop, tablet, mobile) to ensure that blocks and buttons adjust appropriately to different viewport widths",
23+
}},
24+
}); err != nil {
25+
log.Fatal("failed to add single test case", err)
26+
}
27+
28+
// Add multiple test cases
29+
if err := qasCSV.AddTestCases([]qascsv.TestCase{{
30+
Title: "Cart should be cleared after making the checkout",
31+
Folder: []string{"Bistro Delivery", "Cart", "Checkout"},
32+
Priority: "medium",
33+
Tags: []string{"Cart", "checkout", "REQ-6", "Functional"},
34+
Preconditions: "1. Order is placed\n2. Successful message is shown",
35+
Steps: []qascsv.Step{{
36+
Action: "Go back to the \"Main\" page",
37+
Expected: "The \"Cart\" icon is empty",
38+
}, {
39+
Action: "Click the \"Cart\" icon",
40+
Expected: "The empty state is shown in the \"Cart\" modal",
41+
}},
42+
}, {
43+
Title: "Changing to corresponding cursor after hovering the element",
44+
Folder: []string{"Bistro Delivery", "Cart", "Checkout"},
45+
Priority: "low",
46+
Tags: []string{"Checklist", "REQ-6", "UI", "checkout"},
47+
Preconditions: "The \"Checkout\" page is opened",
48+
Steps: []qascsv.Step{{
49+
Action: "Test the display across various screen sizes (desktop, tablet, mobile) to ensure that blocks and buttons adjust appropriately to different viewport widths",
50+
}},
51+
}}); err != nil {
52+
log.Fatal("failed to add multiple test cases", err)
53+
}
54+
55+
// Generate CSV string
56+
csvStr, err := qasCSV.GenerateCSV()
57+
if err != nil {
58+
log.Fatal("failed to generate CSV", err)
59+
}
60+
fmt.Println(csvStr)
61+
62+
// We can also directly write the CSV to a file
63+
// if err := qascsv.WriteCSVToFile("example.csv"); err != nil {
64+
// log.Fatal("failed to write CSV to file", err)
65+
// }
66+
}

go.mod

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module github.com/hypersequent/qasphere-csv
2+
3+
go 1.23.4
4+
5+
require (
6+
github.com/go-playground/validator/v10 v10.23.0
7+
github.com/hashicorp/go-multierror v1.1.1
8+
github.com/pkg/errors v0.9.1
9+
github.com/stretchr/testify v1.10.0
10+
)
11+
12+
require (
13+
github.com/davecgh/go-spew v1.1.1 // indirect
14+
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
15+
github.com/go-playground/locales v0.14.1 // indirect
16+
github.com/go-playground/universal-translator v0.18.1 // indirect
17+
github.com/hashicorp/errwrap v1.0.0 // indirect
18+
github.com/leodido/go-urn v1.4.0 // indirect
19+
github.com/pmezard/go-difflib v1.0.0 // indirect
20+
golang.org/x/crypto v0.19.0 // indirect
21+
golang.org/x/net v0.21.0 // indirect
22+
golang.org/x/sys v0.17.0 // indirect
23+
golang.org/x/text v0.14.0 // indirect
24+
gopkg.in/yaml.v3 v3.0.1 // indirect
25+
)

go.sum

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
4+
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
5+
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
6+
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
7+
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
8+
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
9+
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
10+
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
11+
github.com/go-playground/validator/v10 v10.23.0 h1:/PwmTwZhS0dPkav3cdK9kV1FsAmrL8sThn8IHr/sO+o=
12+
github.com/go-playground/validator/v10 v10.23.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
13+
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
14+
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
15+
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
16+
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
17+
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
18+
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
19+
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
20+
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
21+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
22+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
23+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
24+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
25+
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
26+
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
27+
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
28+
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
29+
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
30+
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
31+
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
32+
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
33+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
34+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
35+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
36+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)