Събитие
Създаване на интелигентни приложения
17.03, 23 ч. - 21.03, 23 ч.
Присъединете се към поредицата срещи, за да изградите мащабируеми AI решения, базирани на реални случаи на употреба с колеги разработчици и експерти.
Регистрирайте се сегаТози браузър вече не се поддържа.
Надстройте до Microsoft Edge, за да се възползвате от най-новите функции, актуализации на защитата и техническа поддръжка.
This article introduces the concept of testing and illustrates how different kinds of tests can be used to validate code. Various tools are available for testing .NET applications, such as the .NET CLI or Integrated Development Environments (IDEs).
Automated tests are a great way to ensure that the application code does what its authors intend. This article covers unit tests, integration tests, and load tests.
A unit test is a test that exercises individual software components or methods, also known as a "unit of work." Unit tests should only test code within the developer's control. They don't test infrastructure concerns. Infrastructure concerns include interacting with databases, file systems, and network resources.
For more information on creating unit tests, see Testing tools.
An integration test differs from a unit test in that it exercises two or more software components' ability to function together, also known as their "integration." These tests operate on a broader spectrum of the system under test, whereas unit tests focus on individual components. Often, integration tests do include infrastructure concerns.
A load test aims to determine whether or not a system can handle a specified load. For example, the number of concurrent users using an application and the app's ability to handle interactions responsively. For more information on load testing of web applications, see ASP.NET Core load/stress testing.
Keep in mind there are best practices for writing tests. For example, Test Driven Development (TDD) is when you write a unit test before the code it's meant to check. TDD is like creating an outline for a book before you write it. The unit test helps developers write simpler, readable, and efficient code.
.NET is a multi-language development platform, and you can write various test types for C#, F#, and Visual Basic. For each of these languages, you can choose between several test frameworks.
xUnit is a free, open-source, community-focused unit testing tool for .NET. The original inventor of NUnit v2 wrote xUnit.net. xUnit.net is the latest technology for unit testing .NET apps. It also works with ReSharper, CodeRush, and TestDriven.NET. xUnit.net is a project of the .NET Foundation and operates under its code of conduct.
For more information, see the following resources:
NUnit is a unit-testing framework for all .NET languages. Initially, NUnit was ported from JUnit, and the current production release has been rewritten with many new features and support for a wide range of .NET platforms. It's a project of the .NET Foundation.
For more information, see the following resources:
MSTest is the Microsoft test framework for all .NET languages. It's extensible and works with both .NET CLI and Visual Studio. For more information, see the following resources:
The MSTest runner is a lightweight and portable alternative to VSTest for running tests in continuous integration (CI) pipelines, and in Visual Studio Test Explorer. For more information, see MSTest runner overview.
You can run a solutions unit test from the .NET CLI with the dotnet test command. The .NET CLI exposes most of the functionality that Integrated Development Environments (IDEs) make available through user interfaces. The .NET CLI is cross-platform and available to use as part of continuous integration and delivery pipelines. The .NET CLI is used with scripted processes to automate common tasks.
Whether you're using Visual Studio or Visual Studio Code, there are graphical user interfaces for testing functionality. There are more features available to IDEs than the CLI, for example, Live Unit Testing. For more information, see Including and excluding tests with Visual Studio.
For more information, see the following articles:
Обратна връзка за .NET
.NET е проект с отворен код. Изберете връзка, за да предоставите обратна връзка:
Събитие
Създаване на интелигентни приложения
17.03, 23 ч. - 21.03, 23 ч.
Присъединете се към поредицата срещи, за да изградите мащабируеми AI решения, базирани на реални случаи на употреба с колеги разработчици и експерти.
Регистрирайте се сегаОбучение
Модул
C# testing in Visual Studio - Training
Start testing your C# apps by using the testing tools in Visual Studio. Learn to write tests, use Test Explorer, create test suites, and apply the red, green, refactor pattern to write code.
Сертифициране
Microsoft Certified: Power Platform Developer Associate - Certifications
Demonstrate how to simplify, automate, and transform business tasks and processes using Microsoft Power Platform Developer.