CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/golang-github-com-onsi-ginkgo-v2

A mature testing framework for Go designed to help you write expressive specs

Overall
score

97%

Overview
Eval results
Files

task.mdevals/scenario-4/

Test Suite Runner

Build a test suite runner that executes BDD-style tests for a simple calculator module. The runner should support both serial and parallel test execution modes.

Requirements

Implement a test suite that:

  1. Tests a calculator module with basic arithmetic operations (add, subtract, multiply, divide)
  2. Organizes tests using descriptive, behavior-driven containers
  3. Supports running tests serially (default mode)
  4. Supports running tests in parallel when requested
  5. Integrates with the standard Go testing framework

Implementation Details

Calculator Module (calculator.go)

The calculator module provides these operations:

package calculator

func Add(a, b int) int
func Subtract(a, b int) int
func Multiply(a, b int) int
func Divide(a, b int) (int, error)

The Divide function returns an error if the divisor is zero.

Test Suite (calculator_suite_test.go and calculator_test.go)

Create a test suite that:

  • Uses a standard Go test function as the entry point
  • Configures the test runner with appropriate settings
  • Organizes test cases into logical groupings
  • Includes test cases for:
    • Addition of positive numbers
    • Addition of negative numbers
    • Subtraction operations
    • Multiplication operations
    • Division operations (including division by zero error case)

The test suite should work with both:

  • Standard serial execution: go test
  • Parallel execution mode when supported by the runner

Test Cases

The following test cases should be implemented:

  • Addition adds two positive numbers correctly @test
  • Addition handles negative numbers correctly @test
  • Subtraction subtracts two numbers correctly @test
  • Multiplication multiplies two numbers correctly @test
  • Division divides two numbers correctly @test
  • Division returns an error when dividing by zero @test

File Structure

calculator/
├── calculator.go           # Calculator implementation
└── test/
    ├── calculator_suite_test.go  # Suite setup
    └── calculator_test.go        # Test specifications

Dependencies { .dependencies }

Ginkgo { .dependency }

Provides BDD testing framework support.

@describes

Gomega { .dependency }

Provides matcher/assertion library.

@describes

Install with Tessl CLI

npx tessl i tessl/golang-github-com-onsi-ginkgo-v2

tile.json