MCSD MCSD Testing and Quality Assurance 1 — Questions and Answers
Question 1: Which Visual Studio feature allows developers to run automated tests and view code coverage results directly in the IDE?
- Test Explorer (Correct answer)
- Solution Explorer
- Class View
- Object Browser
Correct answer: Test Explorer
Test Explorer in Visual Studio provides a unified interface for discovering, running, and viewing results of automated tests along with code coverage metrics.
Question 2: In the context of .NET unit testing, what does the [TestInitialize] attribute do in MSTest?
- Marks a method to run before each test method in the test class (Correct answer)
- Marks a method to run once before all tests in the assembly
- Marks a method as a unit test
- Marks a method to run after each test method
Correct answer: Marks a method to run before each test method in the test class
[TestInitialize] decorates a method that MSTest will automatically execute before every individual test method in the class to set up prerequisites.
Question 3: When using xUnit.net for .NET testing, which attribute is used to provide multiple sets of inline data to a theory test?
- [InlineData] (Correct answer)
- [TestCase]
- [DataRow]
- [Values]
Correct answer: [InlineData]
[InlineData] in xUnit.net supplies a single set of arguments to a [Theory]-decorated test method, and multiple [InlineData] attributes provide multiple data sets.
Question 4: What is the primary purpose of mocking frameworks like Moq in .NET unit testing?
- To create substitute objects that simulate dependencies without real implementations (Correct answer)
- To generate test data automatically from production databases
- To measure application performance under load
- To enforce coding standards during test runs
Correct answer: To create substitute objects that simulate dependencies without real implementations
Moq and similar mocking frameworks let you create fake implementations of interfaces or classes so unit tests can isolate the subject under test from real dependencies.
Question 5: Which Azure DevOps feature integrates with Visual Studio to run automated tests as part of a CI/CD pipeline?
- Azure Pipelines (Correct answer)
- Azure Boards
- Azure Artifacts
- Azure Repos
Correct answer: Azure Pipelines
Azure Pipelines enables continuous integration by automatically triggering builds and running test suites whenever code is pushed to the repository.
Question 6: In .NET, what does code coverage percentage measure in automated testing?
- The proportion of source code lines executed during test runs (Correct answer)
- The number of tests passing versus failing
- The time taken for all tests to complete
- The number of bugs found per test method
Correct answer: The proportion of source code lines executed during test runs
Code coverage reports what percentage of your source lines, branches, or methods were actually exercised when the test suite ran, indicating untested code areas.
Which Visual Studio feature allows developers to run automated tests and view code coverage results directly in the IDE?