Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial commit #1

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = tab
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on:
push:
branches: ['main']
pull_request:
types: [opened, synchronize]

jobs:
test:
name: Test
timeout-minutes: 15
runs-on: ubuntu-latest

env:
CI: true

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2

- uses: actions/setup-go@v5
with:
go-version: '^1.23.4'
- run: go version

- name: Install gofumpt
run: go install mvdan.cc/gofumpt@latest

- name: Add gofumpt to PATH
run: echo "$GOPATH/bin" >> $GITHUB_PATH

- name: Run gofumpt
run: diff <(echo -n) <(gofumpt -d .)

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.62.2
args: --verbose --timeout=3m

- name: Test
run: make test
12 changes: 1 addition & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
Expand All @@ -14,12 +11,5 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
go.work.sum

# env file
# .env files
.env
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
GOCMD=GO111MODULE=on go

linters-install:
@golangci-lint --version >/dev/null 2>&1 || { \
echo "installing linting tools..."; \
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.62.2; \
}

lint: linters-install
golangci-lint run

test:
$(GOCMD) test -v -cover -race ./...

.PHONY: test lint linters-install
57 changes: 56 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,57 @@
# qasphere-csv
Library to write QA Sphere CSV files with test cases

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.

## Features

- Programmatically create large projects instead of manual entries.
- Facilitate migration from older test management systems by converting exported data into QA Sphere's CSV format.
- Includes in-built validations to ensure CSV files meet QA Sphere's requirements for smooth import.

## How to Use

### Starting from Scratch

Clone the repository and explore the [basic example](examples/basic/main.go). Modify the code to add your test cases and run:

```bash
go run examples/basic/main.go
```

Use the `WriteCSVToFile()` method to write directly to a file.

### Integrating into an Existing Project

To include `qasphere-csv` in your Go project, run:

```bash
go get github.com/hypersequent/qasphere-csv
```

Import the library in your Go project:

```go
import qascsv "github.com/hypersequent/qasphere-csv"
```

Refer to the [basic example](examples/basic/main.go) for API usage.

## Importing Test Cases on QA Sphere

1. Create a new Project, if not already done.
2. Open the project from the **Dashboard** and navigate to the **Test Cases** tab.
3. Select the **Import** option from the dropdown in the top right.

For more details, please check the [documentation](https://docs.qasphere.com/).

## Contributing

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.

Before submitting a pull request, please ensure:
1. Appropriate unit tests are added and existing tests pass - `make test`
2. Lint checks pass - `make lint`

## License

This library is available under the MIT License. For more details, please see the [LICENSE](license) file.
66 changes: 66 additions & 0 deletions examples/basic/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package main

import (
"fmt"
"log"

qascsv "github.com/hypersequent/qasphere-csv"
)

func main() {
// Create a new instance of QASphereCSV
qasCSV := qascsv.NewQASphereCSV()

// Add a single test case
if err := qasCSV.AddTestCase(qascsv.TestCase{
Title: "Changing to corresponding cursor after hovering the element",
Folder: []string{"Bistro Delivery", "About Us"},
Priority: "low",
Tags: []string{"About Us", "Checklist", "REQ-4", "UI"},
Preconditions: "The \"About Us\" page is opened",
Steps: []qascsv.Step{{
Action: "Test the display across various screen sizes (desktop, tablet, mobile) to ensure that blocks and buttons adjust appropriately to different viewport widths",
}},
}); err != nil {
log.Fatal("failed to add single test case", err)
}
Comment on lines +15 to +26
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove duplicate test case title.

There's a duplicate test case title "Changing to corresponding cursor after hovering the element" in both the single and multiple test case sections. Consider using unique titles for better clarity and maintainability.

Also applies to: 29-53


// Add multiple test cases
if err := qasCSV.AddTestCases([]qascsv.TestCase{{
Title: "Cart should be cleared after making the checkout",
Folder: []string{"Bistro Delivery", "Cart", "Checkout"},
Priority: "medium",
Tags: []string{"Cart", "checkout", "REQ-6", "Functional"},
Preconditions: "1. Order is placed\n2. Successful message is shown",
Steps: []qascsv.Step{{
Action: "Go back to the \"Main\" page",
Expected: "The \"Cart\" icon is empty",
}, {
Action: "Click the \"Cart\" icon",
Expected: "The empty state is shown in the \"Cart\" modal",
}},
}, {
Title: "Changing to corresponding cursor after hovering the element",
Folder: []string{"Bistro Delivery", "Cart", "Checkout"},
Priority: "low",
Tags: []string{"Checklist", "REQ-6", "UI", "checkout"},
Preconditions: "The \"Checkout\" page is opened",
Steps: []qascsv.Step{{
Action: "Test the display across various screen sizes (desktop, tablet, mobile) to ensure that blocks and buttons adjust appropriately to different viewport widths",
}},
}}); err != nil {
log.Fatal("failed to add multiple test cases", err)
}

// Generate CSV string
csvStr, err := qasCSV.GenerateCSV()
if err != nil {
log.Fatal("failed to generate CSV", err)
}
fmt.Println(csvStr)

// We can also directly write the CSV to a file
// if err := qascsv.WriteCSVToFile("example.csv"); err != nil {
// log.Fatal("failed to write CSV to file", err)
// }
}
25 changes: 25 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module github.com/hypersequent/qasphere-csv

go 1.23.4

require (
github.com/go-playground/validator/v10 v10.23.0
github.com/hashicorp/go-multierror v1.1.1
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.10.0
)

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