Primeiro, veja as ferramentas de teste no Visual StudioFirst look at testing tools in Visual Studio
As ferramentas de teste do Visual Studio podem ajudar você e sua equipe a desenvolver e manter altos padrões de excelência de código.Visual Studio testing tools can help you and your team develop and sustain high standards of code excellence.
Observação
O teste de unidade está disponível em todas as edições do Visual Studio.Unit testing is available in all editions of Visual Studio. Outras ferramentas de teste, como Live Unit Testing e IntelliTest, estão disponíveis apenas na edição Visual Studio Enterprise.Other testing tools, such as Live Unit Testing and IntelliTest, are only available in Visual Studio Enterprise edition. Para obter mais informações sobre as edições, confira Comparar IDEs do Visual Studio.For more information about editions see Compare Visual Studio IDEs.
Gerenciador de TestesTest Explorer
A janela Gerenciador de Testes ajuda os desenvolvedores a criar, gerenciar e executar testes de unidade.The Test Explorer window helps developers create, manage, and run unit tests. Você pode usar a estrutura de teste de unidade da Microsoft ou uma das várias estruturas de software livre e de terceiros.You can use the Microsoft unit test framework or one of several third-party and open source frameworks.
- Introdução ao teste de unidadeGet started with unit testing
- Executar testes de unidade com o Gerenciador de TestesRun unit tests with Test Explorer
- Perguntas Frequentes sobre o Gerenciador de TestesTest Explorer FAQ
- Instalar estruturas de teste de unidade de terceirosInstall third-party unit test frameworks
O Visual Studio também é extensível e abre a porta para adaptadores de teste de unidade de terceiros como o NUnit e o xUnit.net.Visual Studio is also extensible and opens the door for third-party unit testing adapters such as NUnit and xUnit.net. Além disso, a capacidade de clone de código caminha lado a lado com o fornecimento de softwares de alta qualidade, ajudando você a identificar blocos de códigos semanticamente semelhantes que podem ser candidatos para correções de bugs comuns ou refatoração.In addition, the code clone capability goes hand-in-hand with delivering high-quality software by helping you identify blocks of semantically similar code that may be candidates for common bug fixes or refactoring.
Live Unit TestingLive Unit Testing
O Live Unit Testing executa testes de unidade automaticamente em segundo plano e exibe graficamente a cobertura de código e os resultados de teste no editor de código do Visual Studio.Live Unit Testing automatically runs unit tests in the background, and graphically displays code coverage and test results in the Visual Studio code editor.
Observação
O Live Unit Testing está disponível apenas no Enterprise Edition e só tem suporte para código .NET.Live unit testing is available in Enterprise edition only and is only supported for .NET code.
IntelliTestIntelliTest
O IntelliTest gera automaticamente os testes de unidade e os dados de teste para o código gerenciado.IntelliTest automatically generates unit tests and test data for your managed code. O IntelliTest melhora a cobertura e reduz drasticamente o esforço para criar e manter os testes de unidade para código novo ou existente.IntelliTest improves coverage and dramatically reduces the effort to create and maintain unit tests for new or existing code.
Observação
O IntelliTest está disponível somente no Enterprise Edition.IntelliTest is available in Enterprise edition only. Há suporte para código C# destinado ao .NET Framework.It is supported for C# code that targets the .NET Framework. No momento, não há suporte para .NET Core e .NET Standard..NET Core and .NET Standard are not currently supported.
- Gerar testes de unidade para seu código com IntelliTestGenerate unit tests for your code with IntelliTest
- IntelliTest – um teste para controlar tudoIntelliTest – One test to rule them all
- Manual de referência do IntelliTestIntelliTest reference manual
Cobertura de códigoCode coverage
A cobertura de código determina qual proporção do código do projeto está sendo testada de fato por testes codificados, como os testes de unidade.Code coverage determines what proportion of your project's code is actually being tested by coded tests such as unit tests. Para se proteger efetivamente contra bugs, os testes devem exercitar ou "cobrir" uma grande proporção de seu código.To guard effectively against bugs, your tests should exercise or "cover" a large proportion of your code.
Observação
A cobertura de código está disponível somente no Enterprise Edition.Code coverage is available in Enterprise edition only.
A análise de cobertura de código pode ser aplicada a código gerenciado e não gerenciado (nativo).Code coverage analysis can be applied to both managed and unmanaged (native) code.
A cobertura de código é uma opção quando você executa métodos de teste usando o Gerenciador de Testes.Code coverage is an option when you run test methods using Test Explorer. A tabela de resultados mostra a porcentagem do código que foi executada em cada assembly, classe e método.The results table shows the percentage of the code that was run in each assembly, class, and method. Além disso, o editor de código-fonte mostra que código foi testado.In addition, the source editor shows you which code has been tested.
- Usar a cobertura de código para determinar quanto do código está sendo testadoUse code coverage to determine how much code is being tested
- Teste de unidade, cobertura de código e análise de clone de código com o Visual Studio (laboratório)Unit testing, code coverage and code clone analysis with Visual Studio (Lab)
- Personalizar a análise de cobertura de códigoCustomize code coverage analysis
Microsoft FakesMicrosoft Fakes
O Microsoft Fakes ajuda a isolar o código que você está testando substituindo outras partes do aplicativo por stubs ou shims.Microsoft Fakes help you isolate the code you're testing by replacing other parts of the application with stubs or shims.
Observação
As falsificações da Microsoft estão disponíveis somente no Enterprise Edition e só são suportadas para código .NET.Microsoft Fakes are available in Enterprise edition only and is supported only for .NET code.
Teste de interface do usuário com Selenium e IU CodificadoUser interface testing with Coded UI and Selenium
Os testes de IU codificados fornecem uma maneira de criar testes totalmente automatizados para validar a funcionalidade e o comportamento da interface do usuário do seu aplicativo.Coded UI tests provide a way to create fully automated tests to validate the functionality and behavior of your application’s user interface. Eles podem automatizar o teste de interface do usuário em várias tecnologias, incluindo aplicativos UWP baseados em XAML, aplicativos de navegador e aplicativos SharePoint.They can automate UI testing across a variety of technologies, including XAML-based UWP apps, browser apps, and SharePoint apps.
Observação
A interface do usuário codificada é um recurso preterido.Coded UI is a deprecated feature.
Se escolher um dos melhores testes de interface do usuário codificada ou testes de interface do usuário baseados em navegador genérico com o Selenium, o Visual Studio fornecerá todas as ferramentas que você precisa.Whether you choose best-of-breed Coded UI Tests or generic browser-based UI testing with Selenium, Visual Studio provides all the tools you need.
- Usar a automação da interface do usuário para testar o códigoUse UI automation to test your code
- Introdução à criação, edição e manutenção de um teste de interface do usuário codificadoGet started creating, editing, and maintaining a coded UI test
- Testar aplicativos UWP com testes de IU codificadosTest UWP apps with coded UI tests
- Introdução aos testes de IU codificados com o Visual Studio Enterprise (laboratório)Introduction to coded UI tests with Visual Studio Enterprise (Lab)