Junior — Middle
What tool or library have you used for test automation in your projects?
sobes.tech AI
Answer from AI
For test automation in C# projects, the following tools are often used:
- NUnit — a popular framework for unit testing, supports attributes for describing tests, and is easy to integrate with CI.
- xUnit.net — a modern framework focused on simplicity and extensibility.
- MSTest — a testing framework built into Visual Studio.
- Moq — a library for creating mock objects, helps isolate the components under test.
Example of a simple test with NUnit:
using NUnit.Framework;
[TestFixture]
public class CalculatorTests
{
[Test]
public void Add_WhenCalled_ReturnsSum()
{
var calculator = new Calculator();
var result = calculator.Add(2, 3);
Assert.AreEqual(5, result);
}
}
The choice of a specific tool depends on the project requirements and team preferences, but NUnit and xUnit are the most common.