Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Explorer does not see any test #81

Closed
ghost opened this issue Sep 18, 2015 · 28 comments
Closed

Test Explorer does not see any test #81

ghost opened this issue Sep 18, 2015 · 28 comments

Comments

@ghost
Copy link

ghost commented Sep 18, 2015

I use Visual Studio Express 2015 and want to have Nunit tests.
I've added Nunit framework, Nunit adapter (Nunit Runner also tried to add) to the solution/project reference then cleaned and built solution but test did not appear in Test Explorer.
I tried to use Nunit framework with Console Application, with Class Library and with both there were no tests in Test Explorer after solution was built.

As a reference I used the following tutorial:
https://www.visualstudio.com/en-us/get-started/code/create-and-run-unit-tests-vs

My code is :
''''
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Selenium_Second_Project
{
[TestFixture]
public class Class1
{
IWebDriver driver = new ChromeDriver();
static void Main(string[] args)
{
}
[SetUp]
public void Initialise()
{
driver.Manage().Window.Maximize();
driver.Navigate().GoToUrl("http://www.google.com");
}
[Test]
public void ExecuteTest_1()
{
IWebElement element = driver.FindElement(By.Name("q"));
element.SendKeys("test automation");
System.Threading.Thread.Sleep(5000);
}
[TearDown]
public void CloseDriver()
{
driver.Close();
}
}
}
''''
image

@jkrall
Copy link

jkrall commented Sep 23, 2015

Same problem in my project. Worked before, but perhaps a recent VS upgrade broke this?

@OsirisTerje
Copy link
Member

The Express editions don't support extensions. Are you sure you didn't use another edition earlier ?
Please try the Community Edition instead, it covers more, it supports extensions, and is still free, for all but enterprises. https://www.visualstudio.com/products/visual-studio-community-vs

@johnlundberg
Copy link

I have the same problem in Enterprise 2015

@OsirisTerje
Copy link
Member

@johnlundberg: Do you use the NUnit vsix adapter or the NUnit nuget adapter ? And, NUnit 2 or NUnit 3 ?

@johnlundberg
Copy link

I installed from the "Extensions and Updates" menu so I suppose it is the vsix adapter. It is NUnit 2.

@OsirisTerje
Copy link
Member

If you do a test run, what is written to the Output/Test pane ?

@johnlundberg
Copy link

I click "Run All" in the Test Explorer and the solution builds, but nothing at all gets written to the Tests pane.

I used Code Rush's test runner before updating to Visual Studio 2015, so I am a bit unfamiliar with the Test Explorer. I might be doing something wrong but I don't think so.

@OsirisTerje
Copy link
Member

I you just do a Rebuild All, then look in the Output/Test pane, you should see the following:
------ Discover test started ------
NUnit VS Adapter 2.0.0.0 discovering tests is started
NUnit VS Adapter 2.0.0.0 discovering test is finished
========== Discover test finished: 1 found (0:00:00.0990052) ==========
The Test Exlorer runs a discovery when the solution is built.
Do you see anything there at all ?

@johnlundberg
Copy link

Ah, Rebuild did the trick, I thought the discovering would be triggered by a build.

Also my Default Processing Architecture was set to x86 while my tests where x64. Therefore they were never found the last time I did the rebuild.

Sorry to take up your time, and thank you for your help

@OsirisTerje
Copy link
Member

Nice to hear!
Btw, The x86 - x64 is a bit nasty, it should be more easy to see, or have a warning to it.

@Atanoly , @jkrall : If it really wasnt Express, do any of you have anything similar ? Or did you try the Community Edition?

@ghost
Copy link
Author

ghost commented Oct 6, 2015

Dear colleagues, sorry for not taking part in discussion, was away for vacation. I've installed VS community edition, changed the Build Platfrom Target option to Any CPU (my system is 64) and the issue gone. After my project was build I got tests in Test Explorer.
I tried to change the Build PlatfromTarget option to Any CPU on VS Express edition but tests did not appear in Test Explorer.

Many thanks once again for helping in fixing the issue.

@ghost ghost closed this as completed Oct 6, 2015
@Joel-S-Black
Copy link

I was having this same issue with Nunit 3.* and test runner 3.*. The only thing that identified the issue was using the Developer Command Prompt and running the "dotnet test" command. The issue which the command prompt surfaced was that the test-runner couldn't "Could not load file or assembly 'Microsoft.DotNet.InternalAbstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified." After loading this hidden dependency, my tests were discovered.

@CharliePoole
Copy link
Contributor

CharliePoole commented Dec 2, 2016

@jllblk The NUnit VS adapter does not support .NET Core tests.

@aleksandrov
Copy link

Have the same issue, it does not depend on VS adapter. "dotnet test" command from console just fail.

@Joel-S-Black
Copy link

Go to project.json, under "dependencies" section and manually add a reference to "Microsoft.DotNet.InternalAbstractions:1.0.0.0", this fixed my issue.

@vivrao
Copy link

vivrao commented May 18, 2017

Hi,

I am also seeing no Tests in Run Tests while using NTest with Visual Studio 2015 Enterprise Solution. I have tried all the above mentioned steps except the last one mentioned by jllblk.

Could not locate the option in Microsoft.Any help on the same will be highly appreciated.

@rprouse
Copy link
Member

rprouse commented May 18, 2017

The NUnit VS adapter does not support .NET Core tests.

You need to use dotnet-test-nunit for VS2015 .NET Core or .NET Standard. See https://github.com/nunit/dotnet-test-nunit

@AjitKumarSahoo
Copy link

I had similar issue in which my test was not getting listed after build. In my case, the project that I had created was configured for x64, and by default the "Default Processor Architecture" for the Testing framework was x86. Changing the default processor architecture under Test-->Test Settings to x64 resolved the issue in my case.

@OsirisTerje
Copy link
Member

FWIW: I have a blog post here http://hermit.no/how-to-control-the-selection-of-test-runner-in-tfsvsts-making-it-work-with-x86x64-selected-targets/ discussing the x64/x86 test issue and methods on how to solve it with VS and TFS.

@shaktipattnayak
Copy link

I had the similar kind of issue, where I was pulling the Test Data from a spreadsheet based on the Test Name, so make sure your test names are unique in the spread sheet, otherwise you won't find the test cases in Test Explorer after you build the solution.

@ragavendra
Copy link

I have .net core v2.0 project and I did the clean solution first and then the build where I saw the Microsoft.NET.Test.Sdk compatibility issue in the logs. I didn't need this and removed it, which made the tests visible in the explorer and they could be run.

@dkprajapati1988
Copy link

dkprajapati1988 commented May 10, 2018

If your test project is set to target a 64bit platform, the tests won't show up in the NUnit Test Adapter.

https://stackoverflow.com/questions/19298347/nunit-unit-tests-not-showing-in-test-explorer-with-test-adapter-installed?rq=1

@OsirisTerje
Copy link
Member

@dkprajapati1988 That is not correct.
It will show up, but you need to set the Test execution engine to x64, it is default the x86. In VS, Go to Test/Test Settings/Default Processor Architecture and choose x64.
For CI builds, you must use the runsettings file, or a parameter for the settings, see http://hermit.no/how-to-control-the-selection-of-test-runner-in-tfsvsts-making-it-work-with-x86x64-selected-targets/

@andrewkhomski
Copy link

Hi

Have the same issue - Test would not show up.

0
down vote
Here is the solution that worked for us. Not the best but maybe one can benefit.

Background:

Our scripts were developed with VS 2013 and used NUnit VS Adapter 2.1..
Recently we migrated to VS 2017 and when open the same solution - test wouldn't show in the Test Explorer

Upon Build we would see this message: [Informational] NUnit Adapter 3.10.0.21: Test discovery starting [Informational] Assembly contains no NUnit 3.0 tests: C:\ihealautomatedTests\SeleniumTest\bin\x86\Debug\SeleniumTest.dll [Informational] NUnit Adapter 3.10.0.21: Test discovery complete

Solution (temporary): - Uninstall NUnit Adapter 3.10... - Install NUnit VS Adapter 2.1..

Now the Tests are shown.

Still need to figure out how to make our scripts work with newer Adapter version... Any idea??? - please let me know.

If it is a different topic - please let me know and will remove my comments.

Thank you
Andrew

@CharliePoole
Copy link
Contributor

@andrewkhomski It doesn't sound like the same issue at all, I'm afraid. :-)

You were using the 2.1 adapter, which worked. That indicates you were using NUnit version 2 as the framework, since that's what the "NUnit VS Adapter" supports.

You switched to version 3.10 of the "NUnit 3 VS Adapter", which is not exactly an upgrade but an entirely different product. It only works with the NUnit 3 framework. You don't say you upgraded to the NUnit 3 framework, so I'm assuming you didn't.

So the solution for you appears to be to first upgrade your tests to NUnit 3. For some people that's trivial, for others it's not, since NUnit 3 has breaking changes from NUnit V2. See the Breaking Changes page in the NUnit docs.

If you anticipate problems with an upgrade to NUnit 3, please take a look at my release of NUnit 2.6.6, which gives some help in upgrading. It's available at https://github.com/nunit-legacy/nunitv2.

@andrewkhomski
Copy link

Thank you very much Charlie!

Actually - you are correct - i was too happy that the Tests got shown in the Test Explorer..
However when i tried to run - i got into new errors.

I will research on your article and will provide update.

Thank you,
Andrew

@nadarmuthukumar
Copy link

@maverickcalibre
Copy link

In my case NUnit Test Adapter was not install in VS 2015. I installed NUnit Test Adapter 2.0 since I was running NUnit version 2.6.4. Build the project and test were discovered.

Thanks for all the different ideas thrown up here.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests