Skip to content

go-splittestgen splits test cases into some subsets and print commands to run one of subsets for parallel testing.

License

Notifications You must be signed in to change notification settings

minoritea/go-splittestgen

Repository files navigation

go-splittestgen

[MIT License][license]

go-splittestgen splits test cases into some subsets and print commands to run one of subsets for parallel testing.

Usage

# print test commands
$ go test ./... -list . | go-splittestgen

# execute tests
$ go test ./... -list . | go-splittestgen | sh

Options

  -index uint
        index of parallel testing(default 0)
  -total uint
        process num of parallel testing (default 1)

Installation

# go install
$ go install github.com/minoritea/go-splittestgen/cmd/go-splittestgen
# or just run
$ go test ./... -list . | go run github.com/minoritea/go-splittestgen/cmd/go-splittestgen

Example

GitHub Actions

name: CI
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        parallelism: [3]
        index: [0,1,2]
    steps:
      - uses: actions/setup-go@v2
      - uses: actions/checkout@v2
      - name: Run tests parallelly
        run: |
          go test ./... -list . | \
          go run github.com/minoritea/go-splittestgen/cmd/go-splittestgen -total ${{ matrix.parallelism }} -index ${{ matrix.index }} | \
          sed -e 's/$/ -v -count 1/g' | sh

Author

minoritea

Original Author

Songmu

About

go-splittestgen splits test cases into some subsets and print commands to run one of subsets for parallel testing.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%