Help is needed

1) What is the difference between

using NUnit.Framework;

and

using Microsoft.VisualStudio.TestTools.UnitTesting;

I had a problem running my tests. I create a new project in VS 2010 (File -> New Project -> Visual C # -> Test, and Visual Studio automatically creates some code for me:

using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace TestProject1
{
/// <summary>
/// Summary description for UnitTest1
/// </summary>
[TestClass]
public class UnitTest1
{
    public UnitTest1()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    private TestContext testContextInstance;

    /// <summary>
    ///Gets or sets the test context which provides
    ///information about and functionality for the current test run.
    ///</summary>
    public TestContext TestContext
    {
        get
        {
            return testContextInstance;
        }
        set
        {
            testContextInstance = value;
        }
    }

    #region Additional test attributes
    //
    // You can use the following additional attributes as you write your tests:
    //
    // Use ClassInitialize to run code before running the first test in the class
    // [ClassInitialize()]
    // public static void MyClassInitialize(TestContext testContext) { }
    //
    // Use ClassCleanup to run code after all tests in a class have run
    // [ClassCleanup()]
    // public static void MyClassCleanup() { }
    //
    // Use TestInitialize to run code before running each test 
    // [TestInitialize()]
    // public void MyTestInitialize() { }
    //
    // Use TestCleanup to run code after each test has run
    // [TestCleanup()]
    // public void MyTestCleanup() { }
    //
    #endregion

    [TestMethod]
    public void TestMethod1()
    {
        //
        // TODO: Add test logic here
        //
    }
}
}

I record my test using the Selenium IDE and I get:

using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using NUnit.Framework;
using Selenium;

namespace SeleniumTests
{
[TestFixture]
public class Untitled2
{
private ISelenium selenium;
private StringBuilder verificationErrors;

[SetUp]
public void SetupTest()
{
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://localhost/km/pldefault.aspx");
selenium.Start();
verificationErrors = new StringBuilder();
}

[TearDown]
public void TeardownTest()
{
try
{
selenium.Stop();
}
catch (Exception)
{
// Ignore errors if unable to close the browser
}
Assert.AreEqual("", verificationErrors.ToString());
}

[Test]
public void TheUntitled2Test()
{
}
}
}

I am really confused when I combine these two.

+3
source share
2 answers

NUnit and MSTest (i.e. Microsoft.VisualStudio.TestTools.UnitTesting) are unit testing modules. Both of them fulfill the same goal; so that you define and run unit tests.

Selenium NUnit . , MSTest. , . Visual Studio TFS.

NUnit Nuget. ( ) NUnit. . VS, , TestDriven.NET, Resharper.

+2

!;-) , ( ) . unit test, xUnit. Visual Studio , unit test. Selenium : NUnit. . , Selenium , . NUnit, , .

+4

All Articles