Live Unit Testing 總覽Live Unit Testing overview

當您進行程式碼變更時,Live Unit Testing 會自動執行您的單元測試。Live Unit Testing executes your unit tests automatically and in real time as you make code changes. 這可讓您更安心地重構及變更程式碼。This lets you refactor and change code with greater confidence. 當您編輯程式碼時,Live Unit Testing 會自動執行所有受影響的測試,以確保您的變更不會引進回歸。Live Unit Testing automatically executes all impacted tests as you edit your code to ensure that your changes do not introduce regressions.

Live Unit Testing 指出您的單元測試是否充分涵蓋您的程式碼。Live Unit Testing indicates whether your unit tests adequately cover your code. 它會以圖形方式即時描述程式碼涵蓋範圍。It graphically depicts code coverage in real time. 您可以一眼看到有多少測試涵蓋每一行程式碼,以及任何單元測試未涵蓋的行數。You can see at a glance how many tests cover each line of code and which lines are not covered by any unit tests.

如果您的方案包含一或多個單元測試專案,您可以 > > 從 Visual Studio 的最上層功能表列中選取 [測試] Live Unit Testing 啟動,藉以啟用 Live Unit Testing。If you have a solution that includes one or more unit test projects, you can enable Live Unit Testing by selecting Test > Live Unit Testing > Start from the top-level menu bar in Visual Studio.


Live Unit Testing 僅適用于 Visual Studio Enterprise edition,而且只有在 .NET 中才支援。Live Unit Testing is only available in Visual Studio Enterprise edition and is supported only in .NET.

深入了解 Live Unit Testing:To learn more about Live Unit Testing: