github.com/kubeshop/testkube@v1.17.23/contrib/executor/template/README.md (about)

     1  ![Testkube Logo](https://raw.githubusercontent.com/kubeshop/testkube/main/assets/testkube-color-gray.png)
     2  
     3  # Welcome to TestKube Template Executor
     4  
     5  TestKube Template Executor is a test executor skeleton for [TestKube](https://testkube.io).  
     6  You can use it as basic building blocks for creating a new executor.
     7  
     8  # What is an Executor?
     9  
    10  Executor is nothing more than a program wrapped into Docker container which gets JSON (testube.Execution) OpenAPI based document as an input and returns a stream of JSON output lines (testkube.ExecutorOutput), where each output line is simply wrapped in this JSON, similar to the structured logging idea. 
    11  
    12  
    13  # Issues and enchancements 
    14  
    15  Please follow the main [TestKube repository](https://github.com/kubeshop/testkube) for reporting any [issues](https://github.com/kubeshop/testkube/issues) or [discussions](https://github.com/kubeshop/testkube/discussions)
    16  
    17  ## Implemention in several steps:
    18  
    19  1. Create new repo on top of this template 
    20  2. Change `go.mod` file with your path (just replace `github.com/kubeshop/testkube-executor-template` project-wise with your package path) 
    21  3. Implement your own Runner on top of [runner interface](https://github.com/kubeshop/testkube/blob/main/pkg/runner/interface.go
    22  4. Change Dockerfile - use base image of whatever test framework/library you want to use
    23  5. Build and push dockerfile to some repository
    24  6. Register Executor Custom Resource in your cluster 
    25  
    26  ```yaml
    27  apiVersion: executor.testkube.io/v1
    28  kind: Executor
    29  metadata:
    30    name: postman-executor
    31    namespace: testkube
    32  spec:
    33    executor_type: job
    34    image: kubeshop/testkube-template-executor:0.0.1
    35    types:
    36    - example/test
    37  ```
    38  
    39  
    40  ## Architecture
    41  
    42  This Executor template offers you basic building blocks to write a new executor based on TestKube 
    43  libraries written in Go programming language, but you're not limited only to Go, you can 
    44  write in any other programming language like Rust, Javascript, Java or Clojure.
    45  
    46  The only thing you'll need to do is to follow the OpenAPI spec for input `testkube.Execution` 
    47  (passed as first argument in JSON form) and all output should be JSON lines 
    48  with `testkube.ExecutorOutput` spec.  
    49  You should also have a final `ExecutorOutput` with `ExecutionResult` attached somewhere after successful (or failed) test execution.
    50  
    51  Resources: 
    52  - [OpenAPI spec details](https://https://docs.testkube.io/openapi)
    53  - [Spec in YAML file](https://raw.githubusercontent.com/kubeshop/testkube/main/api/v1/testkube.yaml)
    54  
    55  Go based resources for input and output objects:
    56  - input: [`testkube.Execution`](https://github.com/kubeshop/testkube/blob/main/pkg/api/v1/testkube/model_execution.go)
    57  - output line: [`testkube.ExecutorOutput`](https://github.com/kubeshop/testkube/blob/main/pkg/api/v1/testkube/model_executor_output.go)
    58  
    59  
    60  ## Examples
    61  
    62  - This template repo, which is the simplest one
    63  - [Postman executor](https://github.com/kubeshop/testkube-executor-postman)
    64  - [Cypress executor](https://github.com/kubeshop/testkube-executor-cypress)
    65  - [Curl executor](https://github.com/kubeshop/testkube-executor-curl)
    66  
    67  
    68  # Testkube 
    69  
    70  For more info go to [main testkube repo](https://github.com/kubeshop/testkube)
    71  
    72  ![Release](https://img.shields.io/github/v/release/kubeshop/testkube) [![Releases](https://img.shields.io/github/downloads/kubeshop/testkube/total.svg)](https://github.com/kubeshop/testkube/tags?label=Downloads) ![Go version](https://img.shields.io/github/go-mod/go-version/kubeshop/testkube)
    73  
    74  ![Docker builds](https://img.shields.io/docker/automated/kubeshop/testkube-api-server) ![Code build](https://img.shields.io/github/workflow/status/kubeshop/testkube/Code%20build%20and%20checks) ![Release date](https://img.shields.io/github/release-date/kubeshop/testkube)
    75  
    76  ![Twitter](https://img.shields.io/twitter/follow/thekubeshop?style=social) ![Slack](https://testkubeworkspace.slack.com/join/shared_invite/zt-2arhz5vmu-U2r3WZ69iPya5Fw0hMhRDg#/shared-invite/email)
    77   #### [Documentation](https://docs.testkube.io/openapi) | [Slack](https://testkubeworkspace.slack.com/join/shared_invite/zt-2arhz5vmu-U2r3WZ69iPya5Fw0hMhRDg#/shared-invite/email)