Skip to content

Commit

Permalink
Merge pull request #1 from AmityCo/feat/support-integration-test
Browse files Browse the repository at this point in the history
Support integration test report
  • Loading branch information
bnaing authored Jan 31, 2023
2 parents f9745a5 + 9763a31 commit a41b082
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def __repr__(self) -> str:

def calculateSuccessRate(self):
success = self.total - (self.failed + self.errors)
self.successRate = round(success * 100 / self.total)
if self.successRate == 100:
self.successRate = round(success * 100 / self.total, 2)
if self.successRate == 100.0:
self.statusEmoji = ":check_mark:"


Expand Down Expand Up @@ -64,11 +64,14 @@ def parse(path, rc: ResultCount, failed: FailedTest):
failed.add(methodName, className)


def traverse(repo: ResultCount, uc: ResultCount, other: ResultCount, failed: FailedTest):
def traverse(inte: ResultCount, repo: ResultCount, uc: ResultCount, other: ResultCount, failed: FailedTest):
pathlist = Path().rglob("TEST-*.xml")
for p in pathlist:
path = str(p)
if path.lower().endswith("repositorytest.xml"):
if path.lower().endswith("integrationtest.xml"):
parse(path, inte, failed)

elif path.lower().endswith("repositorytest.xml"):
parse(path, repo, failed)

elif path.lower().endswith("usecasetest.xml"):
Expand All @@ -79,20 +82,22 @@ def traverse(repo: ResultCount, uc: ResultCount, other: ResultCount, failed: Fai


def main():
inte = ResultCount("Integration")
repo = ResultCount("Repository")
uc = ResultCount("Use Case")
other = ResultCount("Others")

failed = FailedTest()

traverse(repo, uc, other, failed)
traverse(inte, repo, uc, other, failed)

inte.calculateSuccessRate()
repo.calculateSuccessRate()
uc.calculateSuccessRate()
other.calculateSuccessRate()

result = ":memo: SDK Test Report#" + \
str(repo) + "##" + str(uc) + "##" + str(other) + "##" + str(failed)
str(inte) + "##" + str(repo) + "##" + str(uc) + "##" + str(other) + "##" + str(failed)

print(result)
try:
Expand Down

0 comments on commit a41b082

Please sign in to comment.