šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

github.com/benjaminheng/go-test-runner

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/benjaminheng/go-test-runner

v0.0.0-20210302153526-24fae22708e4
Source
Go
Version published
Created
Source

go-test-runner

A simple tool to select individual Go subtests to execute.

Dependencies:

  • fzf
go get github.com/benjaminheng/go-test-runner

Demo

Invoke go-test-runner with a package list. A package list uses the three dot syntax, for instance ./path/to/my/package/....

$ go-test-runner ./...
$ go-test-runner ./path/to/my/package/...

A fzf process will be started showing the tests and subtests parsed from the input package.

  TestOfferUpdater_UpdateOffersByID$/offers_are_updated$
  TestOfferUpdater_UpdateOffersByID$/validate$/invalid_column_in_preconditions$
  TestOfferUpdater_UpdateOffersByID$/validate$/invalid_column_in_changemap$
  TestOfferUpdater_UpdateOffersByID$/validate$/no_changemap$
  TestOfferUpdater_UpdateOffersByID$/validate$/no_ids$
  TestOfferUpdater_UpdateOffersByID$/validate$
  TestOfferUpdater_UpdateOffersByID$
  TestOfferUpdater_UpdateOffer$/offer_is_updated$
  TestOfferUpdater_UpdateOffer$/validate$/invalid_offer$
  TestOfferUpdater_UpdateOffer$/validate$/nil_offer$
> TestOfferUpdater_UpdateOffer$/validate$
  TestOfferUpdater_UpdateOffer$
  85/85
>

In this example we select TestOfferUpdater_UpdateOffer$/validate$. This will be passed to the -run flag in go test. The full command:

go test -v ./... -run TestOfferUpdater_UpdateOffer$/validate$

Only the selected subtests are executed. The command output:

=== RUN   TestOfferUpdater_UpdateOffer
=== RUN   TestOfferUpdater_UpdateOffer/validate
=== RUN   TestOfferUpdater_UpdateOffer/validate/nil_offer
=== RUN   TestOfferUpdater_UpdateOffer/validate/invalid_offer
--- PASS: TestOfferUpdater_UpdateOffer (0.00s)
    --- PASS: TestOfferUpdater_UpdateOffer/validate (0.00s)
        --- PASS: TestOfferUpdater_UpdateOffer/validate/nil_offer (0.00s)
        --- PASS: TestOfferUpdater_UpdateOffer/validate/invalid_offer (0.00s)
PASS
ok      command-line-arguments  0.058s

FAQs

Package last updated on 02 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts