Sobes.tech
Junior — Middle

What tools or frameworks have you used for test automation?

sobes.tech AI

Answer from AI

For automating testing in C#, the following tools and frameworks are often used:

  • NUnit — a popular framework for unit testing, allows writing and running tests.
  • xUnit — a modern testing framework with a convenient API.
  • MSTest — a testing framework built into Visual Studio.
  • Selenium WebDriver — for automating web application testing, supports C#.
  • SpecFlow — a framework for BDD (behavior-driven development), integrates with NUnit or MSTest.

Example of a simple test with NUnit:

using NUnit.Framework;

[TestFixture]
public class CalculatorTests
{
    [Test]
    public void Add_TwoNumbers_ReturnsSum()
    {
        var calculator = new Calculator();
        int result = calculator.Add(2, 3);
        Assert.AreEqual(5, result);
    }
}