|
| 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 | +} |
0 commit comments