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

Individual test doesn't seem to run after changing its name #7123

Open
adamw opened this issue Jan 16, 2025 · 4 comments
Open

Individual test doesn't seem to run after changing its name #7123

adamw opened this issue Jan 16, 2025 · 4 comments
Labels
bug Something that is making a piece of functionality unusable test-explorer

Comments

@adamw
Copy link

adamw commented Jan 16, 2025

Describe the bug

I encountered the following scenario:

As part of this Tapir PR, I added a new test case to VerifyYamlTest, at the bottom:

   test("xyz") {
     val e = endpoint.post.in(header[Option[String]]("X-test"))

     val expectedYaml = load("expected_string_body_response.yml")
     val actualYaml = OpenAPIDocsInterpreter().toOpenAPI(e, Info("Entities", "1.0")).toYaml

     println(expectedYaml)

     val actualYamlNoIndent = noIndentation(actualYaml)
     actualYamlNoIndent shouldBe expectedYaml
  }

After some time the green "play"button appeared and I was able to run this single test. As expected, it failed, and I could see the println result.

However, then I changed the title to should not include '400 invalid value for: header test' response if an optional string header is used, re-run the test, and it was reported as "green". Additionally, no test output was recorded (The test case did not report any output. ) - so I don't think it was ever run. Running from SBT, the test failed.

Image

Expected behavior

The test should still fail.

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

v1.4.2

Extra context or search terms

No response

@kasiaMarek
Copy link
Contributor

This happens if you try to run the test too early before the compilation finishes and code lenses get updated. To avoid confusion we could remove test run code lenses from files that are not compiled and only add them back when it compiles.

@adamw
Copy link
Author

adamw commented Jan 21, 2025

I don't think so, I regularly have situations where tests "seem to run" but in fact nothing happens (the code is not run). Arbitrary amount of time after compilation.

@kasiaMarek
Copy link
Contributor

kasiaMarek commented Jan 21, 2025

That means that at times things don't update correctly. Similar issue: #6809
@adamw, is the problem strictly related to code lenses or is the information in the test explorer also outdated?

@kasiaMarek kasiaMarek added bug Something that is making a piece of functionality unusable test-explorer labels Jan 21, 2025
@adamw
Copy link
Author

adamw commented Jan 21, 2025

Not sure what's code lenses / test explorer :)

The problem was related to running tests by clicking on the green tick/play button the left of the code. Then the incorrect results where in the "test results" tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is making a piece of functionality unusable test-explorer
Projects
Status: Triage
Development

No branches or pull requests

2 participants