Skip to content

Commit 68d1922

Browse files
authored
Create README.md
1 parent 06cbb86 commit 68d1922

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
```markdown
2+
# Template Name: cobra-report
3+
4+
## Description
5+
6+
The **cobra-report** template is designed for the COBRA Toolbox to provide a concise overview of your test suite results. It displays key metrics including the total number of tests, passed tests, failed tests, and skipped tests. Additionally, when failures occur, it renders a detailed table listing each failed test along with its failure message.
7+
8+
---
9+
10+
## How to Use
11+
12+
Reference this template by its name in your workflow configuration:
13+
14+
```
15+
cobra-report
16+
```
17+
18+
Then, add it to your workflow file as follows:
19+
20+
```yaml
21+
- name: Publish Test Report
22+
uses: ctrf-io/github-test-reporter@v1
23+
with:
24+
report-path: './ctrf/*.json'
25+
community-report: true
26+
communty-reportn-name: cobra-report
27+
if: always()
28+
```
29+
30+
Ensure your report JSON files are generated correctly and placed in the expected path.
31+
32+
## Important Considerations
33+
34+
- **JSON Structure:** Verify that your test results JSON conforms to the expected format, so that the template can correctly parse the summary values and test statuses.
35+
- **Custom Helpers:** This template utilizes custom helpers such as `getCtrfEmoji`, `formatMessage`, and `anyFailedTests`. Make sure these are available in your environment.
36+
- **Conditional Rendering:** The detailed table of failed tests will only appear if there is at least one test with a `failed` status.
37+
38+
## What it Looks Like
39+
40+
### Summary Section
41+
42+
| **Tests 📝** | **Passed ✅** | **Failed ❌** | **Skipped ⏭️** |
43+
| --- | --- | --- | --- |
44+
| {{ctrf.summary.tests}} | {{ctrf.summary.passed}} | {{ctrf.summary.failed}} | {{ctrf.summary.skipped}} |
45+
46+
### Failed Tests Details
47+
48+
{{#if (anyFailedTests ctrf.tests)}}
49+
<table>
50+
<thead>
51+
<tr>
52+
<th>Failed Tests {{getCtrfEmoji "failed"}}</th>
53+
<th>Fail Message</th>
54+
</tr>
55+
</thead>
56+
<tbody>
57+
{{#each ctrf.tests}}
58+
{{#if (eq status "failed")}}
59+
<tr>
60+
<td>{{getCtrfEmoji "failed"}} {{name}}</td>
61+
<td>
62+
{{#if message}}
63+
{{~{formatMessage message}}}
64+
{{else}}
65+
No failure message
66+
{{/if}}
67+
</td>
68+
</tr>
69+
{{/if}}
70+
{{/each}}
71+
</tbody>
72+
</table>
73+
{{else}}
74+
<p>No failed tests ✨</p>
75+
{{/if}}
76+
77+
This template provides a streamlined and effective overview of your testing performance, making it easy to identify issues and monitor overall progress.
78+
```

0 commit comments

Comments
 (0)