Tests: extract the duplicated console-capture and output-folder scaffolding
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ái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- csharp
- Lĩnh vực
- testing-qa
Hướng nghiên cứu
Bắt đầu với các fixture của UnityDataTool.Tests được nêu trong issue, đặc biệt là AnalyzeOverwriteTests, AnalyzeExitCodeTests, FindRefsTests và UnityDataToolPlayerDataTests, rồi so sánh mã thiết lập thư mục và mã ghi nhận lệnh của chúng. Xem xét SQLTestHelper trước khi chọn một helper dùng chung riêng biệt hoặc một fixture cơ sở. Công việc được xem là hoàn tất khi các mẫu bị trùng lặp đã được chuyển đổi trong toàn bộ các fixture và test suite vẫn vượt qua.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The test fixtures in UnityDataTool.Tests each re-implement the same two pieces of scaffolding.
Running a command and capturing its output. Every fixture that needs to assert on what a command
printed redirects Console.Out / Console.Error into a StringWriter, calls Program.Main, and
restores the originals in a finally. There are three named variants of this —
AnalyzeOverwriteTests.RunAnalyze (stderr only), AnalyzeExitCodeTests.RunAnalyze (both streams),
FindRefsTests.RunFindRefsOn — plus a large number of copies written inline inside individual test
methods, for example the two no-TypeTree tests in UnityDataToolPlayerDataTests.
Output folder setup and teardown. OneTimeSetup creates a per-fixture folder under the test
directory and SetCurrentDirectorys into it; Teardown calls SqliteConnection.ClearAllPools() and
deletes the folder's files and subdirectories. This block is duplicated nearly verbatim across
roughly 15 fixtures.
Neither is causing bugs, but it means a change to how tests run a command or clean up has to be made
in many places, and each new fixture starts by copying 40 lines.
Suggested shape:
- A shared helper that runs a command and returns
(exitCode, stdout, stderr)— or combined output,
which is what most assertions want.SQLTestHelperis the project's existing shared helper but is
SQL-specific, so a small separate helper class is probably a better home. - A base fixture (or a helper method) for the output-folder creation and teardown.
Then migrate the fixtures over, which can be done incrementally.
Raised during the review of the fix for #115, which added one more copy of both patterns.
- Ngôn ngữ chính
- C#
- Star
- 821
- Fork
- 71
- Merge trung bình
- 3 giờ 13 phút
- Pull request đã merge (30 ngày)
- 9
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 Unity-Technologies/UnityDataTools
-
Binary test data is not fully covered by .gitattributes and can be mangled by EOL conversion Đang mở
Độ 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 75/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Unity-Technologies/UnityDataTools#116 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Tất cả issue của Unity-Technologies/UnityDataTools
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 ·