Skip to content

Getting Started · chapter 3 of 9 · ● ● ● ○ ○ ○ ○ ○ ○

3 · Hello, TestLab: your first test, by hand

Goal: write one small test yourself, see it pass, then see it fail. No AI yet. Time: 15 minutes

The service you test

The hello service is a tiny API. Its address is in box B of your handout.

Call Answers
GET /hello {"message": "Hello, Tractus-X!"}
GET /parts The parts P-1001 and P-1002
GET /parts/{partId} That part, or 404
GET /health {"status": "UP"}
Full specification (OpenAPI)
openapi: 3.0.3
info:
  title: Hello service
  version: "1.0.0"
  description: >
    A tiny read-only API for the first test of the Eclipse Tractus-X E2E testing
    tutorial. It says hello and knows two parts. Every answer is JSON, errors
    included.
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
  - url: /
paths:
  /hello:
    get:
      summary: Say hello
      operationId: sayHello
      responses:
        "200":
          description: The greeting.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Greeting" }
              example: { message: "Hello, Tractus-X!" }
  /parts:
    get:
      summary: List the parts
      operationId: listParts
      responses:
        "200":
          description: Every part the service knows.
          content:
            application/json:
              schema:
                type: array
                items: { $ref: "#/components/schemas/PartSummary" }
  /parts/{partId}:
    get:
      summary: Read one part
      operationId: getPart
      parameters:
        - name: partId
          in: path
          required: true
          schema: { type: string, example: P-1001 }
      responses:
        "200":
          description: The part.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Part" }
              example: { partId: P-1001, name: Brake disc, manufacturerPartId: BD-4711, weightKg: 7.2 }
        "404":
          description: No part with this id.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Problem" }
  /health:
    get:
      summary: Is the service up?
      operationId: health
      responses:
        "200":
          description: The service is up.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status: { type: string, example: UP }
components:
  schemas:
    Greeting:
      type: object
      required: [message]
      properties:
        message: { type: string }
    PartSummary:
      type: object
      required: [partId, name]
      properties:
        partId: { type: string }
        name: { type: string }
    Part:
      type: object
      required: [partId, name, manufacturerPartId, weightKg]
      properties:
        partId: { type: string }
        name: { type: string }
        manufacturerPartId: { type: string }
        weightKg: { type: number }
    Problem:
      type: object
      required: [status, title]
      properties:
        status: { type: integer }
        title: { type: string }
        detail: { type: string }

Not at the workshop? Run it with Docker as its README shows, at http://localhost:8080.

The test

tests/says_hello.yaml
kind: test
syntax: v1-alpha

namespace: hello-e2e
id: says-hello

metadata:
  name: "The service says hello"
  version: "v0.1.0"
  description: Calls GET /hello and checks the greeting.

execution:
  - id: say_hello
    uses: http/http_request
    name: Ask the service to say hello
    with:
      url: "${{ env.service_url }}/hello"
    returns:
      status_code:
        type: integer
      body:
        type: object
    validate:
      - uses: validate/assert
        with: { input: status_code, operator: equals, value: 200 }
      - uses: validate/field
        with: { input: body, path: message, operator: equals, value: "Hello, Tractus-X!" }
  • uses picks the action: one HTTP request.
  • with gives its inputs. ${{ env.service_url }} is the address, taken from the manifest.
  • returns names the outputs you check.
  • validate holds the checks. The step passes only if all of them hold.

The syntax cheat sheet explains every part.

Steps

  1. Install TestLab (Python 3.12+) and the VS Code extension YAML by Red Hat:

    pip install "tractusx-testlab==1.0.0a25"
    
  2. Unpack hello-start.zip into a folder hello and open it in VS Code.

  3. In index.yaml, set service_url to the address on your handout.
  4. Create tests/says_hello.yaml with the test above. Its first line turns on autocomplete:

    # yaml-language-server: $schema=https://raw.githubusercontent.com/eclipse-tractusx/tractusx-testlab/v1-alpha25/src/tractusx_testlab/compiler/schemas/tck_test.schema.json
    
  5. In index.yaml, replace tests: [] with:

    tests:
      - id: says_hello.yaml
        name: The service says hello
    
  6. Run:

    testlab validate index.yaml
    testlab run index.yaml --yes
    
  1. Open the Test Suite (box B) and click the Test Suite IDE icon on the left.
  2. Click Open File and choose hello-start.zip.

    The IDE welcome screen

  3. ☰ → Environment → Variables → service_url: enter the address on your handout.

  4. New ▾ → New Test, then click new-test.yaml.
  5. Open the YAML Editor at the right edge, click Edit, paste the test, click Save. The blocks appear.

    The test as blocks and as YAML

  6. Click Compile, then Run. Save the draft, and click Run again if it does not start. Pick any app under test (or Register an app), click Next to the end, then Run.

More on every button: The Test Suite IDE.

You should now see

  ✓ The service says hello                              PASS
RESULT: PASS  |  1 passed  0 failed  0 skipped

The IDE after the run: passed

Make it fail

  1. Change the expected greeting to Hello, world! and run. It fails with Expected 'Hello, world!', got 'Hello, Tractus-X!'.
  2. Change it back. Green again.

Your turn

Write tests/unknown_part_is_not_found.yaml: ask for part P-9999, expect 404. Register it and run.

Solution
tests/unknown_part_is_not_found.yaml
kind: test
syntax: v1-alpha

namespace: hello-e2e
id: unknown-part-is-not-found

metadata:
  name: "An unknown part is not found"
  version: "v0.1.0"
  description: Negative test. Asks for a part the service does not know.

execution:
  - id: read_unknown_part
    uses: http/http_request
    name: Ask for a part that does not exist
    with:
      url: "${{ env.service_url }}/parts/P-9999"
    returns:
      status_code:
        type: integer
    validate:
      - uses: validate/assert
        with: { input: status_code, operator: equals, value: 404 }
More time? Check the shape of a part
tests/reads_a_part.yaml
kind: test
syntax: v1-alpha

namespace: hello-e2e
id: reads-a-part

metadata:
  name: "A part has the shape the specification promises"
  version: "v0.1.0"
  description: Contract test. Reads part P-1001 and checks it against the Part schema.

execution:
  - id: read_part
    uses: http/http_request
    name: Read part P-1001
    with:
      url: "${{ env.service_url }}/parts/P-1001"
    returns:
      status_code:
        type: integer
      body:
        type: object
    validate:
      - uses: validate/assert
        with: { input: status_code, operator: equals, value: 200 }
      - uses: validate/field
        with: { input: body, path: name, operator: equals, value: "Brake disc" }
      - uses: validate/schema
        with: { input: body, schema: "${{ env.schemas.part }}" }

The finished project is in examples/hello.

Tip

Stuck? YAML error: check the indentation (two spaces, no tabs). Service unreachable: open <address>/health in the browser. No blocks in the IDE: click Save in the YAML editor.

NOTICE

This work is licensed under the CC-BY-4.0.

  • SPDX-License-Identifier: CC-BY-4.0
  • SPDX-FileCopyrightText: 2026 Contributors to the Eclipse Foundation
  • SPDX-FileCopyrightText: 2026 Catena-X Automotive Network e.V.
  • SPDX-FileCopyrightText: 2026 LKS Next
  • Source URL: https://github.com/eclipse-tractusx/tutorial-resources

About this tutorial

Version
v1.0
Added
Nov 2026
Updated
Nov 2026

Authors

Versions

  1. 1.0 Nov 2026 First published, for the Tractus-X Community Days 2026.