Kola

ApiHug Testing Framework Kola

Start using Kola for contract-first, DSL-based testing in ApiHug.

What It Is

Kola is ApiHug's DSL-based testing layer for contract-aware scenarios. It is designed to keep test intent close to the ApiHug contract model instead of scattering it across unrelated fixtures and handwritten test plumbing.

When To Use It

Use Kola when you want to:

  • express API scenarios in a BDD-style DSL
  • keep test cases close to the proto-driven project structure
  • generate and run contract-aware scenarios with the rest of the ApiHug toolchain

Prerequisites

Before you start:

  1. upgrade the project to a Kola-capable ApiHug SDK version
  2. use the current IntelliJ plugin version
  3. confirm the proto module build enables the Kola task in your project setup

Steps

  1. Update the project dependencies to the required ApiHug version in gradle/libs.versions.toml.
  2. Enable Kola in the proto-module build configuration used by your project.
  3. Create the Kola test resources under the proto module test resources area.
  4. Add one feature file using the Kola DSL.
  5. Run the Kola task from the proto module:
Terminal
./gradlew.bat {proto_module}:kolaTest --stacktrace

Example

Groovy
package contracts

import hope.kola.contract.Feature

Feature.make {
    priority 100
    name("Customer login, place order, and check balance")
    Scenario "001 Try login", {
        Given {
            api("UserService", "Login")
        }
        When {
            body {
                set('name', "same")
                set('student.age', 22)
            }
        }
        And {
            booleanAssert("user.live", {
                isTrue()
            })
        }
    }
}

Result

You get a contract-aware test entrypoint that fits the ApiHug workflow more naturally than a disconnected handwritten scenario suite.

Related Pages

  1. What Kola Is
  2. Kola Tool Chain
Copyright © 2026 ApiHug·AI-native Enterprise Architecture Factory