微軟釋出全新輕量級MSTest測試框架執行工具
· 2024-01-26

微軟釋出輕量且高效的測試執行新工具MSTest Runner,可建立獨立的測試執行檔,在效能與儲存資源有限的裝置上實際地進行測試

微軟推出MSTest Runner,這是一個用於MSTest測試的輕量級執行工具,具有高可移植性與高可靠性,供開發者能夠快速地執行測試,在微軟內部專案的測試執行速度可提升達3倍,並且節省4倍的記憶體用量。

MSTest是Visual Studio中的一種測試框架,用於編寫和執行單元測試,提供了一套建立和管理單元測試的工具和類別函式庫,使開發人員可以驗證程式碼在各種情況下,都能正確且可靠地運作。MSTest適用於需要和Visual Studio環境緊密結合的.NET開發專案。

使用MSTest Runner而非VSTest進行測試的好處之一便是可移植性,MSTest Runner是一個可將MSTest測試建置為獨立可移植執行檔的工具,僅一個控制臺應用程式就可託管和執行測試,不再需要諸如vstest.console、dotnet test或Visual Studio等工具,因此即便在效能與儲存資源有限的裝置上,也可以使用生成的控制臺應用程式實際進行測試。

MSTest Runner直接以可執行檔案進行測試,消除了通常在執行測試時所需要的基礎設施。除了簡化測試環境之外,MSTest Runner也可以進行容器化測試,在沒有dotnet SDK的Docker容器中,執行針對dotnet應用程式的測試。微軟正在考慮在MSTest支援NativeAOT,讓開發者能夠在NativeAOT模式下測試應用程式。

由於MSTest Runner使用較少的程序,在減少程序跳轉的情況下,可節省伺服器資源,也消除了程序序列化通訊的需求,改為仰賴.NET API以增加平行性。微軟指出,內部專案改用新的MSTest Runner執行測試,在CPU和記憶體使用上都有巨大的改進,部分專案在使用dotnet test執行時,測試完成速度提升至3倍,記憶體使用量減少4倍。

MSTest Runner採用安全的預設值,使開發者不錯過必要測試,且傾向實施更嚴格的政策,但也提供開發者足夠的靈活度控制測試。除了更安全的預設之外,微軟在MSTest Runner採用新架構,不仰賴資料夾掃描、動態載入或使用反射來偵測和載入擴充套件,這使得本地和CI中可以更容易地實現相同的行為,並且明顯減少從啟動測試應用程式,到執行第一個測試的時間。

MSTest Runner非同步且可平行執行的特性,能夠避免使用VSTest所出現的死當問題。不過MSTest Runner並不會偵測目標框架和平臺,或是任何的.NET配置,這些工作完全仰賴.NET平臺進行,微軟解釋這是為了避免邏輯重複,防止規則突然變化破壞測試。整體來說,MSTest Runner在效能和可靠性都有大幅改進。

而可擴充性也是MSTest Runner另一個重要特性,其以全新的基礎測試平臺和可擴展性模型作為基礎,開發者可以自定義報告生成器、測試排程,滿足特定測試需求和流程,也可以加入自己的日誌記錄工具,甚至是可用的命令列選項,靈活地進行測試。

熱門文章
GAT CDMX 2025 Institutional Academy: Leaders and Experts Analyze the Present and Future of the Gaming Industry in Mexico and Lat
Sports Game
DB Gaming Is One of Asia’s Top-Tier Game Solution Providers, Recognized as a Pioneer in the Asian Gaming Industry.
Marketing
Vietnam's tightening online gaming policy creates new market opportunities
Southeast Asia
Brazil Proposes Raising Gambling Tax Rate to 24%, With Revenue Allocated to Social Security and Healthcare
Regulation
Zenith partners with HUIDU for 2026 World Cup Carnival Official Tour
Online Game
Indiana online casino bill stalls in House committee
Regulation
Gaming & Technology Expo Makes a Powerful Entrance in CDMX
Marketing
GAT Expo Puerto Rico Will Pulse with the New Era of Gaming in the Caribbean
Marketing
SBC Summit Canada to Make Player Safety a Key Pillar of 2026 Agenda
Marketing
PropellerAds Positions Itself as a Go-To Traffic Source for iGaming Advertisers Ahead of a High-Demand Season
Marketing
Super PAC Raises $48 Million: Sports Betting Forces Ramp Up Political Push
Regulation
UK MPs reopen 2025 gambling inquiry as reform stalls
Regulation
That’s a Wrap: AffPapa Conference Madrid 2026 Highlights
Online Game
JILI Partners with Cricket Legend AB de Villiers (ABD) to Launch Exclusive Branded Game Series 100% 11
Sports Game
Institutional Academy that exceeded expectations marked the opening of GAT CDMX
Online Game
首頁
遊戲
合作
發現
我的