I encountered with some errors when tried to add the NUnit Annotation to my code as shown in below image.
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)
{
[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)
}
}
}
1 Answer 1
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/");
Explore related questions
See similar questions with these tags.