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 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)
 }
 }
}
Glorfindel
3161 gold badge7 silver badges15 bronze badges
asked Sep 12, 2017 at 22:51

1 Answer 1

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/");
answered Sep 12, 2017 at 23:49
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.