1

I encountered with some errors when tried to add the NUnit Annotation to my code as shown in below image.

enter image description here

I have done some error research from Here also following instructions from here too but no success.

Here is the code:

using NUnit.Framework;
using OpenQA.Selenium.Firefox;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ebay_Test_Project
{
    class Program
    {
        static void Main(string[] args)
        {

            [Test]

        //Instantiate Firefox Driver
        //Go to Ebay Website
        var driver = new FirefoxDriver();

        FirefoxDriver.Navigate().GoToUrl("https://www.ebay.co.uk/");

        Assert.AreEqual("ebay", driver.Title)

       }
    }
}
3

The Test annotation goes outside of the test method. You've placed it inside.

Try this:

[Test]
void myTestMethod()
{
    ... your test code here ...
}

Also, the Test annotation may not work on a static method, or on a method with parameters. (I don't remember the details. It's been a while since I used C#.)

I'll bet there's another syntax error on the line that navigates to the Ebay site. If so, try this:

driver.Navigate().GoToUrl("https://www.ebay.co.uk/");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.