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

tools: migrate test generation features to gopls #1594

Open
emil14 opened this issue Jun 28, 2021 · 5 comments
Open

tools: migrate test generation features to gopls #1594

emil14 opened this issue Jun 28, 2021 · 5 comments

Comments

@emil14
Copy link

emil14 commented Jun 28, 2021

Is your feature request related to a problem? Please describe.
I'm always frustrated when I click on "Generate test for function" and see "No tests were generated for ...".

Describe the solution you'd like
I would like to see a reason of why there was no tests were generated. For example - "test for ... already exist".

Additional context
It would be perfect to see a location of generated tests if there is already existing one. Or after successful generation.

@gopherbot gopherbot added this to the Untriaged milestone Jun 28, 2021
@stamblerre stamblerre modified the milestones: Untriaged, Backlog Jun 28, 2021
@stamblerre stamblerre changed the title Add info to "No tests generated for" message Add feedback if test generation fails Jun 28, 2021
@stamblerre stamblerre added the HelpWanted Issues that are not prioritized by the maintainers. Help is requested from community contributors. label Jun 28, 2021
@n1lesh
Copy link
Contributor

n1lesh commented Jul 13, 2021

@stamblerre I would like to work on this if no one's working.

@stamblerre
Copy link
Contributor

Sounds good! /cc @hyangah to confirm that this would be a good thing to work on

@n1lesh
Copy link
Contributor

n1lesh commented Jul 21, 2021

Please correct me if I'm wrong, to generate tests vscode-go calls gotests lib internally as a child process.

However, gotests doesn't return any error if test(s) don't get generated other than "No tests were generated for...". The generateTest method (from gotests) ignores the func if test is already generated for it, and returns no error.

Probably modifying gotests to return an error for existing tests would be a better idea?

@stamblerre
Copy link
Contributor

@n1lesh: Thanks for digging into the underlying cause! An alternative option may actually be to move the test generation logic into gopls itself, so that we can adjust the behavior more easily. Would you be willing to work on a gopls change that adds a command to generate tests instead? I know that's a bigger ask than this fix, but I'd be happy to offer pointers if you're interested.

@n1lesh
Copy link
Contributor

n1lesh commented Jul 23, 2021

@stamblerre I can work on the gopls change.

@hyangah hyangah changed the title Add feedback if test generation fails tools: migrate test generation features to gopls Jul 28, 2021
@hyangah hyangah added this to Needs triage in Tools Management via automation Sep 10, 2021
@suzmue suzmue self-assigned this Jan 11, 2022
@hyangah hyangah removed the HelpWanted Issues that are not prioritized by the maintainers. Help is requested from community contributors. label Feb 8, 2022
@suzmue suzmue removed their assignment Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Tools Management
  
Needs triage
Development

No branches or pull requests

6 participants