vscode-phpunit icon indicating copy to clipboard operation
vscode-phpunit copied to clipboard

Add the ability to run tests from the source code files

Open cpliakas opened this issue 8 years ago • 1 comments

First off, this is an excellent extension. I love how easy it is to run individual tests via cmd + shift + P.

There is a feature in the Golang extension which I feel would be great to incorporate into this extension to make running tests even easier. Specifically, there is a code lens that enables you to run tests right from the source code files as show in the image below:

screen shot 2017-11-12 at 8 31 13 am

I'm not positive, but it seems that the code at https://github.com/Microsoft/vscode-go/blob/master/src/goRunTestCodelens.ts is where the magic happens in the Golang extension. Anyways, I thought it would be worth posting here for feedback as to whether this would be useful, and if so, possible to implement in this extension.

cpliakas avatar Nov 12 '17 13:11 cpliakas

Thanks, yes that should be possible to add.

Would need some restrictions to which files and functions they would appear on though:

  • A file must end in *Test.php
  • Function must start with test* or have @test in the docblock docs

Then we could add these (code lenses?) to test the whole class or single tests.

I'd also add a flag: disableCodeLense: default false.

elonmallin avatar Nov 13 '17 08:11 elonmallin

Added this feature now ages later and released a new version 4.8.0

elonmallin avatar Nov 23 '23 21:11 elonmallin