-
Notifications
You must be signed in to change notification settings - Fork 34
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
Release060 #10
Merged
Merged
Release060 #10
Changes from 30 commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
7e8982a
[060] test collection reworked. hooks work reworked TODO: fix async
2df5e90
[060] fix version
fa2b427
[060] fix async. TODO: fix AfterAll
91a8b73
[060] fixed all async hooks
5ef3129
[060] remove commented code
3394f51
[060] remove commented code
babf227
[060] update testify version
4bed8fa
[060] update allure version to v0.6.0
13ec291
[060] lint fixes
ca2b875
[060] dependencies update
e955b37
[060] test plan fix
5652bde
[061] update framework version
2f1e5ac
[062] fix test plan filter
1784686
[062] update version
7208d18
[063] fix of id type
4483031
[063] update framework version
719a490
[064] fix npe with TestPlan
f4d1662
[065] fix Suite Tests filtering with TestPlan
f7c722c
[065] update framework version
8bd727d
[066] hard parallel fix
15392e9
[066] fix package naming for internal suites
44700d5
[066] GetTestPlan() now calls only once
90b7e19
[066] update framework version
44fb09e
[v067] add windows support for make demo
koodeex c1ff844
[v067] add windows and linux support for make install
koodeex 09b909e
[v067] add exit suite run if no tests in filter
koodeex 2b8e090
[v067] fix relative path support for test plan feature
koodeex b2d8b9b
[v068] fix relative path support for test plan feature
koodeex de7b6b1
[v069] fix relative path support for test plan feature
koodeex 72f49e4
[v068] fix relative path support for test plan feature
koodeex e14ff69
[0610] fix tests and suites naming
95a560c
[0610] add TB.Fatal and TB.Fatalf support
5832f20
[0610] add mixed async example
059f428
[0610] update framework version
9a6ebb1
[0611] fix lint and tests
6baaa2d
[0611] fix lint
29214d2
[0611] fix make run (now make examples always return true)
374c1cd
[0611] create README_new.md
18bce53
[0611] add examples
dd49f0c
[0611] remove README_old.md
d203d85
[0611] README.md update
2503e63
[0611] README.md update
d7c914d
[0611] add Name, Fail, FailNow and Skipf support due [ISSUE-11]
15b273e
[0611] Name() fix
e3a2a01
[0611] naming fix
22d0642
[0611] StepCtx failNow will fail step now before finishing.
a1ffed4
[0611] README.md update
7c3f6dc
[0611] README.md update
a265406
[0611] README.md update
021b929
[0611] README.md update
32d526d
[0611] README.md update
306a2ac
[0611] README.md update
1d63799
[0611] README.md update
5d62e6d
[0611] Now testplan will notify if it will found testplan.json (inste…
38e9b65
[0611] Fixed tagging in mixed_test example
6c9f6b9
[0611] Fixed update README.md and description of some comments
94141f3
[0611] add async test example
84b77e5
[0611] BeforeAll panic case fix
01879b3
[0611] Commented line remove
b5db445
Merge branch 'master' into release060
114eada
[0611] allure version update
906af99
[0611] remove examples lint
674b1c0
[0611] update dependencies
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
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
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 |
---|---|---|
@@ -1,16 +1,19 @@ | ||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
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/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= | ||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= | ||
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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||
github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= | ||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= | ||
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= | ||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||
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.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= | ||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||
gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= | ||
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
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
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
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 |
---|---|---|
@@ -1,15 +1,24 @@ | ||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
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/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= | ||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= | ||
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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= | ||
github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= | ||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= | ||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= | ||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= | ||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||
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.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= | ||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||
gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= | ||
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
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
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
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,130 @@ | ||
package testplan | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"io/ioutil" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
"sync" | ||
) | ||
|
||
var ( | ||
once = sync.Once{} | ||
testPlan = initTestPlan() | ||
) | ||
|
||
// Path to testplan.json | ||
const testPlanPath = "ALLURE_TESTPLAN_PATH" | ||
koodeex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
type TestCase struct { | ||
ID int `json:"id"` | ||
Selector string `json:"selector"` | ||
} | ||
|
||
type TestPlan struct { | ||
Version string `json:"version"` | ||
Tests []*TestCase `json:"tests"` | ||
} | ||
|
||
func newTestPlan() (*TestPlan, error) { | ||
koodeex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
filePath := os.Getenv(testPlanPath) | ||
if filePath == "" { | ||
return nil, fmt.Errorf("{%s} environment variable not set", testPlanPath) | ||
} | ||
if !strings.HasSuffix(filePath, ".json") { | ||
return nil, fmt.Errorf("%s environment variable has a wrong format. Please, set path to .json file. Current path:%s", testPlanPath, filePath) | ||
} | ||
|
||
testPlanRaw, readFileErr := findTestPlan(filePath) | ||
if readFileErr != nil { | ||
return nil, readFileErr | ||
} | ||
|
||
plan := &TestPlan{} | ||
err := json.Unmarshal(testPlanRaw, plan) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
if plan != nil && len(plan.Tests) == 0 { | ||
return nil, fmt.Errorf("no any tests found in %s", filePath) | ||
} | ||
return plan, nil | ||
} | ||
|
||
// IsSelected returns true if selector matches with testplan selector | ||
// TODO: ID parsing from TestOps | ||
func (p *TestPlan) IsSelected(id, selector string) bool { | ||
for _, t := range p.Tests { | ||
if t.Selector == selector { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
||
func initTestPlan() *TestPlan { | ||
var ( | ||
err error | ||
tPlan *TestPlan | ||
) | ||
|
||
testPlanOnce := func() { | ||
tPlan, err = newTestPlan() | ||
if err != nil { | ||
fmt.Printf("%s\n", err.Error()) | ||
} | ||
} | ||
once.Do(testPlanOnce) | ||
return tPlan | ||
} | ||
|
||
// GetTestPlan ... | ||
func GetTestPlan() *TestPlan { | ||
return testPlan | ||
} | ||
|
||
func findTestPlan(path string) (testPlanRaw []byte, readFileErr error) { | ||
testPlanRaw, readFileErr = ioutil.ReadFile(filepath.Clean(path)) | ||
if readFileErr == nil && testPlanRaw != nil { | ||
return testPlanRaw, nil | ||
} | ||
dir, getWdErr := os.Getwd() | ||
if getWdErr != nil { | ||
return nil, getWdErr | ||
} | ||
|
||
pathParts := strings.Split(dir, string(os.PathSeparator)) | ||
|
||
// windows absolute path workaround | ||
// issue describing: https://github.com/golang/go/issues/26953#issuecomment-412447719 | ||
if strings.HasSuffix(pathParts[0], ":") { | ||
pathParts[0] = pathParts[0] + "/" | ||
} | ||
|
||
// os.Getwd() returns current test folder. | ||
// trying to walk up the absolute path to find testplan.json | ||
tmpPathParts := pathParts | ||
for _, _ = range pathParts { | ||
basicPath := filepath.Join(tmpPathParts...) | ||
absolutePath := filepath.Join(basicPath, filepath.Clean(path)) | ||
if pathParts[0] == "" && len(pathParts) > 1 { | ||
absolutePath = "/" + absolutePath | ||
} | ||
|
||
testPlanRaw, readFileErr = ioutil.ReadFile(absolutePath) | ||
if readFileErr != nil { | ||
// stop looking if project root found | ||
_, gErr := ioutil.ReadFile(filepath.Join(basicPath, "go.mod")) | ||
if gErr == nil { | ||
return | ||
} | ||
tmpPathParts = tmpPathParts[:len(tmpPathParts)-1] | ||
continue | ||
} | ||
break | ||
} | ||
return | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go fmt