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 and 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)


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


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


1 Answer 1


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

Try this:

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:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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