Skip to content

Commit

Permalink
Merge pull request #50 from elisasre/txtfmt
Browse files Browse the repository at this point in the history
make coverages automatically as txt formatted
  • Loading branch information
zetaab authored Nov 23, 2023
2 parents f2e6f07 + c569eb7 commit 3236c2b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
12 changes: 10 additions & 2 deletions golang/target/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,20 @@ func (Go) Test(ctx context.Context) {

// UnitTest run all unit tests
func (Go) UnitTest(ctx context.Context) error {
return golang.UnitTest(ctx, golang.UnitTestCoverDir)
err := golang.UnitTest(ctx, golang.UnitTestCoverDir)
if err != nil {
return err
}
return golang.CreateCoverProfile(ctx, golang.UnitTestCoverProfile, golang.UnitTestCoverDir)
}

// IntegrationTest run integration tests
func (Go) IntegrationTest(ctx context.Context) error {
return golang.IntegrationTest(ctx, BuildTarget, golang.IntegrationTestPkg, golang.IntegrationTestCoverDir, IntegrationTestRunArgs...)
err := golang.IntegrationTest(ctx, BuildTarget, golang.IntegrationTestPkg, golang.IntegrationTestCoverDir, IntegrationTestRunArgs...)
if err != nil {
return err
}
return golang.CreateCoverProfile(ctx, golang.IntegrationTestCoverProfile, golang.IntegrationTestCoverDir)
}

// CoverProfile convert binary coverage into text format
Expand Down
12 changes: 7 additions & 5 deletions golang/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ import (

// Default values used by mageutil/golang/target.Go targets.
const (
IntegrationTestPkg = "./integrationtests"
TestBinDir = "./target/tests/bin/"
UnitTestCoverDir = "./target/tests/cover/unit/"
IntegrationTestCoverDir = "./target/tests/cover/int/"
CombinedCoverProfile = "./target/tests/cover/combined/cover.txt"
IntegrationTestPkg = "./integrationtests"
TestBinDir = "./target/tests/bin/"
UnitTestCoverDir = "./target/tests/cover/unit/"
UnitTestCoverProfile = "./target/tests/cover/unit/cover.txt"
IntegrationTestCoverDir = "./target/tests/cover/int/"
IntegrationTestCoverProfile = "./target/tests/cover/int/cover.txt"
CombinedCoverProfile = "./target/tests/cover/combined/cover.txt"
)

// IntegrationTestRunner executes integration tests in 4 phases:
Expand Down

0 comments on commit 3236c2b

Please sign in to comment.