Support GitLab-compatible Cobertura format in MTP natively
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- csharp
- Lĩnh vực
- testing-qa
Hướng nghiên cứu
Bắt đầu bằng cách chạy lệnh dotnet được tài liệu hóa với --coverage-output-format cobertura và kiểm tra XML Cobertura được tạo ra. So sánh tên tệp lớp và cấu trúc gói của nó với các đường dẫn tương đối và nguồn mà GitLab yêu cầu; được xem là hoàn tất khi đầu ra native hoạt động mà không cần các lệnh sed hậu xử lý và vẫn bảo toàn dữ liệu coverage hợp lệ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hello 👋,
I’m currently using GitLab, which supports displaying code coverage information directly inside the diff view of a merge request. It relies on the Cobertura format for this feature.
Previously, when I was using coverlet, this worked perfectly out of the box. However, after switching to Microsoft.Testing.Platform and the Microsoft.Testing.Extensions.CodeCoverage package, the coverage report stopped working in GitLab.
After some experimentation, I was able to make it work again by manually tweaking the generated Cobertura XML file:
dotnet run -c Release -- --report-junit --coverage --coverage-output-format cobertura --coverage-output myapp.cobertura.xml
sed -i "s@filename=\"$CI_PROJECT_DIR/@filename=\"@g" bin/Release/net9.0/TestResults/myapp.cobertura.xml
sed -i "s@<packages>@<sources><source>$CI_PROJECT_DIR/</source></sources><packages>@g" bin/Release/net9.0/TestResults/myapp.cobertura.xml
The idea here is:
- Replace all absolute paths in the nodes with relative paths.
- Add a node containing the base path.
This makes GitLab correctly display coverage information in merge requests.
However, having to run these sed commands after each test run is not ideal.
👉 Question:
Is there already a built-in option or configuration to achieve this behavior natively?
And if not, would it be possible to add support for relative paths and sources in the Cobertura output?
Thanks a lot for your work on this project!
- Ngôn ngữ chính
- C#
- Star
- 125
- Fork
- 17
- Merge trung bình
- 1 giờ 17 phút
- Pull request đã merge (30 ngày)
- 2
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/codecoverage
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
microsoft/codecoverage#246 · 6 bình luận ·
-
Forward SIGTERM to child process Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
microsoft/codecoverage#237 · 1 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
microsoft/codecoverage#234 · 1 bình luận · 2 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
microsoft/codecoverage#233 · 2 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
microsoft/codecoverage#232 · 6 bình luận ·
Tất cả issue của microsoft/codecoverage
Issue tương tự
-
type/automation type/tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
t/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
ci-failure-cause test-failure
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
area:auth FE mvp P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
klasolsson81/jobbliggaren#1788 ·