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-9/

Test Suite Configuration

Build a test suite runner for a simple calculator package that demonstrates proper test suite initialization and configuration.

Requirements

Create a calculator package with basic operations (add, subtract, multiply, divide) and implement a comprehensive test suite with the following requirements:

  1. Calculator Implementation - Create a calculator.go file with:

    • An Add(a, b int) int function that returns the sum of two integers
    • A Subtract(a, b int) int function that returns the difference
    • A Multiply(a, b int) int function that returns the product
    • A Divide(a, b float64) (float64, error) function that returns the quotient or an error for division by zero
  2. Test Suite Setup - Create a test suite that:

    • Properly initializes the test suite with appropriate suite-level configuration
    • Uses a custom random seed value of 1234 for reproducible test execution
    • Enables verbose output for detailed test information
    • Configures parallel execution with 2 parallel nodes
    • Sets up reporter configuration for clear test output
  3. Test Specifications - Write tests that:

    • Organize tests using descriptive container blocks for each calculator operation
    • Include at least one test case for each operation
    • Use proper test case definition blocks
  4. Integration - Ensure the test suite:

    • Integrates properly with Go's standard testing package
    • Can be executed using the standard go test command
    • Provides clear output indicating suite start and completion

Test Cases { .test-cases }

Test Case 1: Addition Test { .test-case }

Input:

go test -v

Expected Output (partial match):

Running Suite:

The output should show that the test suite is running and at least one addition test passes. { @test }

Test Case 2: Division by Zero { .test-case }

Input:

go test -v

Expected Output (partial match): The test suite should include a test that verifies division by zero returns an error. The test should pass. { @test }

Test Case 3: Parallel Configuration { .test-case }

Input:

go test -v

Expected Output: The test suite should execute with the configured parallel settings. All tests should pass. { @test }

Dependencies { .dependencies }

github.com/onsi/ginkgo/v2 { .dependency }

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

github.com/onsi/gomega { .dependency }

Provides assertion and matcher support for tests.

File Structure

.
├── calculator.go
├── calculator_test.go
└── suite_test.go

Notes

  • Use standard Go testing conventions for file naming
  • Ensure all test files end with _test.go
  • The suite initialization should be in a separate file from the test specifications
  • Follow Go best practices for package organization

Install with Tessl CLI

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

tile.json