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

Removed directory ... due to it not containing any tests #248

Open
mjnorman opened this issue Mar 18, 2020 · 5 comments
Open

Removed directory ... due to it not containing any tests #248

mjnorman opened this issue Mar 18, 2020 · 5 comments

Comments

@mjnorman
Copy link

If you open an issue please include

  1. Dotnet sdk version
    3.1.102

  2. Unit test framework and relevants versions of that

<PackageReference Include="nunit" Version="3.12.0" />
   <PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
   <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0"/>
  1. A link to a repo that replicated the issue
    https://github.com/mjnorman/test-explorer-repro

The issue is that the Test Explorer does not recognize the Tests project. The repro was created by simply

dotnet new mvc -o MyProject.Web
dotnet new nunit -o MyProject.Tests
dotnet new sln
dotnet sln add HRMenu.Web/HRMenu.Web.csproj
dotnet sln add HRMenu.Tests/HRMenu.Tests.csproj

The log indicates:

Starting extension
Finding projects for pattern /test/**/*Tests.csproj
Found 1 matches for pattern in folder /test
Evaluating match /test/MyProject.Tests/MyProject.Tests.csproj
Adding directory /test/MyProject.Tests
Executing dotnet test -t -v=q --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov in /test/MyProject.Tests
[WARNING] Removed directory /test/MyProject.Tests due to it not containting any tests


@Euphoric
Copy link

Euphoric commented Mar 29, 2020

I have same problem

  • .NET Core 3.1.200
  • xunit 2.4.1
  • xunit.runner.visualstudio 2.4.1
  • Microsoft.NET.Test.Sdk 16.4.0

Log:

Finding projects for pattern c:/Users\Radek\Source\Repos\LibraryWebsite/LibraryWebsite.Test/LibraryWebsite.Test.csproj
Found 1 matches for pattern in folder c:\Users\Radek\Source\Repos\LibraryWebsite
Evaluating match c:/Users/Radek/Source/Repos/LibraryWebsite/LibraryWebsite.Test/LibraryWebsite.Test.csproj
Adding directory c:/Users/Radek/Source/Repos/LibraryWebsite/LibraryWebsite.Test
Executing dotnet test -t -v=q in c:/Users/Radek/Source/Repos/LibraryWebsite/LibraryWebsite.Test
[WARNING] Removed directory c:/Users/Radek/Source/Repos/LibraryWebsite/LibraryWebsite.Test due to it not containting any tests

Running dotnet test -t -v=q in c:/Users/Radek/Source/Repos/LibraryWebsite/LibraryWebsite.Test returns:

Test run for C:\Users\Radek\Source\Repos\LibraryWebsite\LibraryWebsite.Test\bin\Debug\netcoreapp3.1\LibraryWebsite.Test.dll(.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 16.5.0
Copyright (c) Microsoft Corporation.  All rights reserved.

The following Tests are available:
    LibraryWebsite.Identity.IdentityAuthenticationApiTest.Discovery_document_retrieved
    LibraryWebsite.Identity.IdentityAuthenticationApiTest.Client_authenticated
    LibraryWebsite.Identity.IdentityAuthenticationApiTest.User_authenticated
    LibraryWebsite.Identity.IdentityAuthenticationApiTest.Authenticates_admin_with_correct_credentials
    LibraryWebsite.Identity.IdentityAuthenticationApiTest.Unauthenticated_user_should_401
    LibraryWebsite.Identity.IdentityAuthenticationApiTest.Authenticates_user_with_correct_credentials
    LibraryWebsite.Identity.IdentityAuthenticationApiTest.Retrieves_LibraryWebsite_Oidc_client_configuration
    LibraryWebsite.Identity.UserApiTest.Needs_admin_priviledges_to_get_users
    LibraryWebsite.Identity.UserApiTest.Retrieves_users
    LibraryWebsite.Health.HealthApiTest.Calls_ping
    LibraryWebsite.Books.BookApiTest.Retrieves_empty_books
    LibraryWebsite.Books.BookApiTest.Creates_and_retrieves_books
    LibraryWebsite.Books.BookApiTest.Creates_and_retrieves_a_book
    LibraryWebsite.Books.BookApiTest.Updating_nonexistent_book_is_error
    LibraryWebsite.Books.BookApiTest.Updates_book
    LibraryWebsite.Books.BookApiTest.Deletes_book
    LibraryWebsite.Books.BookApiTest.Deletes_book_specified_by_id
    LibraryWebsite.Books.BookApiTest.Deleting_non_existing_book_is_noop
    LibraryWebsite.Books.BookApiTest.Book_pagination_default_parameters
    LibraryWebsite.Books.BookApiTest.Book_pagination_with_params
    LibraryWebsite.Books.BookControllerTest.Retrieves_empty_books
    LibraryWebsite.Books.BookControllerTest.Creates_new_book
    LibraryWebsite.Books.BookControllerTest.Book_pagination_limit_is_default
    LibraryWebsite.Books.BookControllerTest.Book_pagination_limit_set
    LibraryWebsite.Books.BookControllerTest.Book_pagination_page
    LibraryWebsite.Books.BookControllerTest.Book_pagination_total_pages
    LibraryWebsite.Books.BookCsvParserTest.Parse_empty_path_is_error
    LibraryWebsite.Books.BookCsvParserTest.Parse_nonexistent_file_is_error
    LibraryWebsite.Books.BookCsvParserTest.Empty_file_is_error
    LibraryWebsite.Books.BookCsvParserTest.Parses_file_lines(datasetId: 1, expectedCount: 100)
    LibraryWebsite.Books.BookCsvParserTest.Parses_file_lines(datasetId: 2, expectedCount: 21)

@GeorchW
Copy link
Contributor

GeorchW commented May 17, 2020

@stefanforsberg Do you know the reasoning behind removing directories that do not contain any tests? Is it to make subsequent discovery faster? Because this behaviour requires to restart the extension when you mess up the build and then try to discover tests, since the directory containing the tests is permanently removed from the list.

@stefanforsberg
Copy link
Collaborator

Tbh I don't remember the reasoning.

I think it had to do with how parsed the results files and keeping track of how many files we are supposed to parse on a full run. So if you pointed the glob to something that matched 5 projects we updated the tree when 5 files had been parsed. If you had managed to add a project that did not contain tests that would never deliver a file and we would wait forever for it to arrive (those forever spinning errors). This might not be an issue once #252 is merged.

The "pointing a glob to match your test-projects" also causes confusion(rightly so), for instances see the issues in #249 so I'd gladly revisit our current concept and see if they can be updated.

If I remember dotnet vstest had trouble discovering tests or reporting test results when executing against solution files but if we could remove our glob approach and just utilize the underlying dotnet tools (eg point to a solution file) that would make the extension more stable.

@GeorchW
Copy link
Contributor

GeorchW commented May 19, 2020

Okay, so apart from the entire globbing issue: now that #252 is merged, we can probably just safely remove this behaviour, right? I'm going to make a PR then.

If I run dotnet test in the MSTest project folder (here), then I get output that looks just about right. This also works with solution files. (I've set the target framework to dotnetcore3.1 though, since I don't have the old versions installed any more.)

On the other hand, using globs to match the projects does not seem like a bad idea to me; I'm not sure how people with multiple test projects are going to work without using globs. I think that #249 is caused by the fact that all subdirectories also match the glob; see my comment there.

@GeorchW
Copy link
Contributor

GeorchW commented Jun 8, 2020

@mjnorman @Euphoric I think this should be fixed in the new version, does the problem persist?

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

No branches or pull requests

4 participants