0

I am getting this error when executing my code.

Starting class as UnitTest1:

using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using TestFramework; namespace Tests { [TestClass] public class UnitTest1 { [TestMethod] public void Can_Go_To_Google_Page() { Pages.Homepage.Goto(); Assert.IsTrue(Pages.Homepage.IsAt()); } } } 

Also I have attached my startup settings: Screenshot of startup settings

Can anyone please tell me how to fix this? I have tried pointing the startup url to the devenv.exe for Visual Studio.

4
  • 1
    You need to execute unit tests from a test runner, not as an application Commented Feb 13, 2017 at 17:16
  • you don't "start" class libraries and/or unit test projects, you utilize them from something else. Unit tests get executed through a runner, not by having the library as a start project Commented Feb 13, 2017 at 17:16
  • So what do you suggest I need to do? Commented Feb 13, 2017 at 17:19
  • Thanks for replying with a clear solution...This did fix the issue.. :) Thanks a lot guys...!! Commented Feb 13, 2017 at 17:25

1 Answer 1

1

Looks like you are trying to run test project as executable (or web site) - instead you should be using VS test runner - Test -> Run -> All Tests. There are also options to run or debug individual tests as well as other test runners like one that is part of R# if you want to use alternative one.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi, Thanks for replying with a clear solution...This did fix the issue.. :-) Was treating this as a web run as you mentioned...So now I am able to run it correctly... Thanks again... :-)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.