cweill / gotests

Automatically generate Go test boilerplate from your source code.
Apache License 2.0
4.97k stars 346 forks source link

Intellij Idea Plugin #24

Open iMaxopoly opened 8 years ago

iMaxopoly commented 8 years ago

Hi, it would be neat to see a plugin for the aforementioned added. Golang Plugin for Intellij has become quite mature overtime.

Thank you for this amazing work.

cweill commented 8 years ago

Hi @kryptodev and thanks! Apologies for the late reply, I was away on vacation.

A plugin would be great, but unfortunately I don't know the first thing about Intellij. I'll leave this issue open in case someone wants to pick it up.

If someone makes their own repo with the plugin, I'll gladly link to it in the README.

epsimatic commented 6 years ago

Support for gotests is included into Goland (similar product from the same vendor)

Right click on the function to test, GotoTestsGenerate test

mekegi commented 6 years ago

It'll be cool add info about Intellij Goland to readme IDE: IntelliJ Goland Shortcut: Ctrl+Shift+T Link to help: https://www.jetbrains.com/help/go/run-debug-configuration-for-go-test.html

gcstang commented 6 years ago

I see a bug when using gotest to generate inside of GoLand. GoLand 2018.2.3 Build #GO-182.4505.32, built on September 20, 2018 JRE: 1.8.0_152-release-1248-b8 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.13.6

go version go1.11 darwin/amd64

  1. Select section of code i.e. function
  2. Push Cmd+Shift+T
  3. Select Generate for selection
  4. Generated code is using a variable of 'tt' and there isn't a variable like '_,tt := ' in the for loop, shows as error. func Test_checkUpdate(t *testing.T) { tests := []struct { name string }{ // TODO: Add test cases. } for range tests { t.Run(tt.name, func(t *testing.T) { checkUpdate() }) } }
zolotov commented 6 years ago

@gcstang it has nothing to do with GoLand, it's #32