-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* xcresult format 3 converter * restucture xcresult3 package * models test * structs broken into multiple files, attachment image export added * removed unnecessary comment * xcresult converters detect func update * dep update * import new xcresult converter * dep update * errcheck fix * some debug logs * some more debug logging * debug log fix, document parsing fix * version conversation fix * do not fail in case of test report issues * struct indent fix, error logging fix * check if xcresulttool available
- Loading branch information
Showing
19 changed files
with
1,152 additions
and
26 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package xcresult3 | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
// ActionsInvocationRecord ... | ||
type ActionsInvocationRecord struct { | ||
Actions struct { | ||
Values []struct { | ||
ActionResult struct { | ||
TestsRef struct { | ||
ID struct { | ||
Value string `json:"_value"` | ||
} `json:"id"` | ||
} `json:"testsRef"` | ||
} `json:"actionResult"` | ||
} `json:"_values"` | ||
} `json:"actions"` | ||
|
||
Issues Issues `json:"issues"` | ||
} | ||
|
||
// Issues ... | ||
type Issues struct { | ||
TestFailureSummaries TestFailureSummaries `json:"testFailureSummaries"` | ||
} | ||
|
||
// TestFailureSummaries ... | ||
type TestFailureSummaries struct { | ||
Values []TestFailureSummary `json:"_values"` | ||
} | ||
|
||
// TestFailureSummary ... | ||
type TestFailureSummary struct { | ||
DocumentLocationInCreatingWorkspace DocumentLocationInCreatingWorkspace `json:"documentLocationInCreatingWorkspace"` | ||
Message Message `json:"message"` | ||
ProducingTarget ProducingTarget `json:"producingTarget"` | ||
TestCaseName TestCaseName `json:"testCaseName"` | ||
} | ||
|
||
// URL ... | ||
type URL struct { | ||
Value string `json:"_value"` | ||
} | ||
|
||
// DocumentLocationInCreatingWorkspace ... | ||
type DocumentLocationInCreatingWorkspace struct { | ||
URL URL `json:"url"` | ||
} | ||
|
||
// ProducingTarget ... | ||
type ProducingTarget struct { | ||
Value string `json:"_value"` | ||
} | ||
|
||
// TestCaseName ... | ||
type TestCaseName struct { | ||
Value string `json:"_value"` | ||
} | ||
|
||
// Message ... | ||
type Message struct { | ||
Value string `json:"_value"` | ||
} | ||
|
||
// failure returns the ActionTestSummaryGroup's failure reason from the ActionsInvocationRecord. | ||
func (r ActionsInvocationRecord) failure(test ActionTestSummaryGroup) string { | ||
target, testCase := test.producingTargetAndTestCaseName() | ||
for _, failureSummary := range r.Issues.TestFailureSummaries.Values { | ||
if failureSummary.ProducingTarget.Value == target && failureSummary.TestCaseName.Value == testCase { | ||
file, line := failureSummary.fileAndLineNumber() | ||
return fmt.Sprintf("%s:%s - %s", file, line, failureSummary.Message.Value) | ||
} | ||
} | ||
return "" | ||
} | ||
|
||
// fileAndLineNumber unwraps the file path and line number descriptor from a given ActionTestSummaryGroup's. | ||
func (s TestFailureSummary) fileAndLineNumber() (file string, line string) { | ||
// file:\/\/\/Users\/bitrisedeveloper\/Develop\/ios\/Xcode11Test\/Xcode11TestUITests\/Xcode11TestUITests.swift#CharacterRangeLen=0&EndingLineNumber=42&StartingLineNumber=42 | ||
if s.DocumentLocationInCreatingWorkspace.URL.Value != "" { | ||
i := strings.LastIndex(s.DocumentLocationInCreatingWorkspace.URL.Value, "#") | ||
if i > -1 && i+1 < len(s.DocumentLocationInCreatingWorkspace.URL.Value) { | ||
return s.DocumentLocationInCreatingWorkspace.URL.Value[:i], s.DocumentLocationInCreatingWorkspace.URL.Value[i+1:] | ||
} | ||
} | ||
return | ||
} |
Oops, something went wrong.