How to integrate with LambdaTest with NUnit?

How to integrate with LambdaTest with NUnit?

Hi Mark,

You can integrate Lambdatest by adding the sample codes below:

 public class NUnitSeleniumSample1
    {
        public static string LT_USERNAME = Environment.GetEnvironmentVariable("LT_USERNAME") == null ? "YOUR LT_USERNAME" : Environment.GetEnvironmentVariable("LT_USERNAME");
        public static string LT_ACCESS_KEY = Environment.GetEnvironmentVariable("LT_ACCESS_KEY") == null ? "YOUR LT ACCESS KEY" : Environment.GetEnvironmentVariable("LT_ACCESS_KEY");
        public static bool tunnel = Boolean.Parse(Environment.GetEnvironmentVariable("LT_TUNNEL") == null ? "false" : Environment.GetEnvironmentVariable("LT_TUNNEL"));
        public static string build = Environment.GetEnvironmentVariable("LT_BUILD") == null ? "YOUR BUILD NAME" : Environment.GetEnvironmentVariable("LT_BUILD");
        public static string seleniumUri = "https://hub.lambdatest.com:443/wd/hub";
    ThreadLocal<IWebDriver> driver = new ThreadLocal<IWebDriver>();
    private String browser;
    private String version;
    private String os;

    [SetUp]
    public void Init()
    {

        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.SetCapability(CapabilityType.BrowserName, "Chrome");
        capabilities.SetCapability(CapabilityType.Version, "96");
        capabilities.SetCapability(CapabilityType.Platform, "Windows 10");

        //Requires a named tunnel.
        if (tunnel)
        {
            capabilities.SetCapability("tunnel", tunnel);
        }
        if (build != null)
        {
            capabilities.SetCapability("build", build);
        }

        capabilities.SetCapability("user", LT_USERNAME);
        capabilities.SetCapability("accessKey", LT_ACCESS_KEY);

        capabilities.SetCapability("name",
        String.Format("{0}:{1}",
        TestContext.CurrentContext.Test.ClassName,
        TestContext.CurrentContext.Test.MethodName));
        driver.Value = new RemoteWebDriver(new Uri(seleniumUri), capabilities, TimeSpan.FromSeconds(600));
        Console.Out.WriteLine(driver);
    }

For your reference, please click here: NUnit with Selenium:Tutorial to run your first test on Lambdatest | LambdaTest