Skip to content

Test Explorer keeps obsolete method names when renaming test suite methods #2974

Open
@soerenkoehler

Description

@soerenkoehler

Describe the bug

Use case: Using test explorer with Testify test suites and renaming suite methods.

Bug: Test explorer keeps old, obsolete and intermediate namings.

Expected behaviour: Test explorer shall mirror only the really existant test methods.

Point in question: How shall test explorer handle test suite methods in general?

Steps to reproduce the behavior:

  1. (If necessary, enable Test Explorer.)
  2. Open Test Explorer in side bar.
  3. Import github.com/stretchr/testify/suite
  4. Create a test suite and inside the suite a method func (s *TestSuite) TestFooBar() (screenshot 01).
  5. Rename the test method to TestFooBarXyz via typing in the editor
  6. Expect one renamed method entry in the test explorer.
  7. Observe in test explorer four methods: one current, three obsolet (screenshot 02).

Screenshots

01 - method created
01-test-method-created

02 - method renamed
02-test-method-renamed

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go from the VS Code integrated terminal.
go version go1.21.0 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
golang.org/x/tools/gopls v0.13.2
    golang.org/x/tools/[email protected] h1:Pyvx6MKvatbX3zzZmdGiFRfQZl0ohPlt2sFxO/5j6Ro=
    github.com/BurntSushi/[email protected] h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
    github.com/google/[email protected] h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
    github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/[email protected] h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
    golang.org/x/exp/[email protected] h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
    golang.org/x/[email protected] h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
    golang.org/x/[email protected] h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
    golang.org/x/[email protected] h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
    golang.org/x/[email protected] h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
    golang.org/x/[email protected] h1:Oush7UwPamr2/iNeNFBuNFj89YyHn0YY69EKDdvANnk=
    golang.org/x/[email protected] h1:A9kONVi4+AnuOr1dopsibH6hLi1Huy54cbeJxnq4vmU=
    honnef.co/go/[email protected] h1:6qXr+R5w+ktL5UkwEbPp+fEvfyoMPche6GkOpGHZcLc=
    mvdan.cc/[email protected] h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
    mvdan.cc/xurls/[email protected] h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.21.0
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
1.82.2
abd2f3db4bdb28f9e95536dfa84d8479f1eb312d
x64
  • Check your installed extensions to get the version of the VS Code Go extension
v0.39.1
Last released 2023-7-17, 16:58:39
Last updated 2023-8-4, 17:57:36
Identifier golang.go
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
Checking configured tools....
GOBIN: undefined
toolsGopath: 
gopath: /home/soeren/go
GOROOT: /opt/go
PATH: /home/soeren/.vscode-server/bin/abd2f3db4bdb28f9e95536dfa84d8479f1eb312d/bin/remote-cli:/home/soeren/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/opt/go/bin:/snap/bin

	go:	/opt/go/bin/go: go version go1.21.0 linux/amd64

	gotests:	/home/soeren/go/bin/gotests		(version: v1.6.0 built with go: go1.21.0)
	gomodifytags:	/home/soeren/go/bin/gomodifytags	(version: v1.16.0 built with go: go1.21.0)
	impl:		/home/soeren/go/bin/impl		(version: v1.1.0 built with go: go1.21.0)
	goplay:		/home/soeren/go/bin/goplay		(version: v1.0.0 built with go: go1.21.0)
	dlv:		/home/soeren/go/bin/dlv			(version: v1.21.0 built with go: go1.21.0)
	staticcheck:	/home/soeren/go/bin/staticcheck		(version: v0.4.3 built with go: go1.21.0)
	gopls:		/home/soeren/go/bin/gopls		(version: v0.13.2 built with go: go1.21.0)

go env
Workspace Folder (go-chdiff): /home/soeren/usrdev/go-chdiff
	GO111MODULE=''
	GOARCH='amd64'
	GOBIN=''
	GOCACHE='/home/soeren/.cache/go-build'
	GOENV='/home/soeren/.config/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='amd64'
	GOHOSTOS='linux'
	GOINSECURE=''
	GOMODCACHE='/home/soeren/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='linux'
	GOPATH='/home/soeren/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/opt/go'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/opt/go/pkg/tool/linux_amd64'
	GOVCS=''
	GOVERSION='go1.21.0'
	GCCGO='gccgo'
	GOAMD64='v1'
	AR='ar'
	CC='gcc'
	CXX='g++'
	CGO_ENABLED='1'
	GOMOD='/home/soeren/usrdev/go-chdiff/go.mod'
	GOWORK=''
	CGO_CFLAGS='-O2 -g'
	CGO_CPPFLAGS=''
	CGO_CXXFLAGS='-O2 -g'
	CGO_FFLAGS='-O2 -g'
	CGO_LDFLAGS='-O2 -g'
	PKG_CONFIG='pkg-config'
	GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1772778533=/tmp/go-build -gno-record-gcc-switches'

Share the Go related settings you have added/edited

"go.testFlags": [
	"-v"
],
"go.testTimeout": "0s",
"go.editorContextMenuCommands": {
	"addTags": false,
	"testAtCursor": false,
	"generateTestForFunction": false,
	"testCoverage": false,
	"playground": false,
	"debugTestAtCursor": false
},
"go.survey.prompt": false,
"go.showWelcome": false,
"go.testExplorer.showOutput": false,
"go.testExplorer.packageDisplayMode": "nested",

Metadata

Metadata

Assignees

No one assigned

    Labels

    Go CompanionIssues relating to the Go Companion extensiongo-testissues related to go test support (test output, test explorer, ...)

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions