การฝึกอบรม
โมดูล
การทดสอบ C# ใน Visual Studio - Training
เริ่มต้นการทดสอบแอป C# ของคุณโดยใช้เครื่องมือทดสอบใน Visual Studio เรียนรู้วิธีการเขียนการทดสอบ ใช้ Test Explorer สร้างชุดการทดสอบ และใช้รูปแบบสีแดง สีเขียว การปรับโครงสร้างเพื่อเขียนโค้ด
เบราว์เซอร์นี้ไม่ได้รับการสนับสนุนอีกต่อไป
อัปเกรดเป็น Microsoft Edge เพื่อใช้ประโยชน์จากคุณลักษณะล่าสุด เช่น การอัปเดตความปลอดภัยและการสนับสนุนด้านเทคนิค
Test runs in Visual Studio involve building the project to update the binaries on disk before using Test Platform to execute your tests. The build time inside Visual Studio can vary depending on the kind of changes made to the code. For larger solutions, builds can be the most expensive part of the test run. In Visual Studio 2022 and later, test execution with hot reload can be enabled to speed up test execution by skipping builds for supported scenarios.
Enable this feature by choosing Test > Options > "(Experimental) Enable Hot Reloaded Test Runs for C# and VB test projects targeting .NET 6 and higher".
This is a new way of test execution where we change a widely used path of validating code. We also expect the user experience around this feature to change as we receive more feedback from users. For these two reasons, we have currently labeled this feature as "experimental".
Once the option is enabled, Test Explorer will automatically use test execution with hot reload when possible. If a hot reload is not possible, it will fall back to the regular behavior of building and running tests. As a user running tests, you do not need to make any changes to your workflow (that is, continue to edit code and run tests).
Under the hood, we are using the same Edit and Continue infrastructure that exists in the newly released Hot Reload experience for editing C#/VB code at runtime to determine the changes made. For this reason, we hot reload only when there are no "rude edits", in which case we fall back to building your tests before executing them. For more details on supported edits, read the Edit and Continue documentation
There are many variables that come into play when estimating how much time this feature will save you. For example:
Ultimately, the speed improvements will be directly related to the build time that would have occurred in that specific test run.
As noted before, for this experimental feature to be complete we require your feedback. If you have a suggestion for how the experience should be, or encounter any problems, please take a moment to report issues to us. Only with your feedback can we ensure that critical problems are resolved, and future decisions are prioritized based on your input.
To reach us please use the Visual Studio feedback mechanism.
การฝึกอบรม
โมดูล
การทดสอบ C# ใน Visual Studio - Training
เริ่มต้นการทดสอบแอป C# ของคุณโดยใช้เครื่องมือทดสอบใน Visual Studio เรียนรู้วิธีการเขียนการทดสอบ ใช้ Test Explorer สร้างชุดการทดสอบ และใช้รูปแบบสีแดง สีเขียว การปรับโครงสร้างเพื่อเขียนโค้ด
เอกสาร
Run unit tests by using Test Explorer - Visual Studio (Windows)
Learn how Visual Studio Test Explorer provides a flexible and efficient way to run your unit tests and view their results.
Run Unit Tests with Test Explorer - Visual Studio (Windows)
Run tests by using Test Explorer in Visual Studio, enable automatic tests after build, view results, group and filter the test list, create playlists, and use shortcuts.
Create a unit test project - Visual Studio (Windows)
Learn how to create a unit test project. The test project can be in the same solution as the production code, or it can be in a separate solution.