Categorygithub.com/dionaditya/curl-to-k6
modulepackage
0.1.2
Repository: https://github.com/dionaditya/curl-to-k6.git
Documentation: pkg.go.dev

# README

curl-to-k6

k6 script generator from curl command

Description

simple cli for k6 script generator from curl command

you need to create .feature file first using gherkin syntex

Getting Started

Dependencies

  • node js >=12
  • go 1.18

Installing

  • Install prettier
    npm i -g prettier
  • Install cli apps
 go install github.com/dionaditya/[email protected]

Executing program

  • create file with .feature extension using gherkin syntax something like this
upload-post.feature
Feature: upload image endpoint
  Scenario: Generate k6 script for create nwe user
    Given curl command:
    """
    curl -v -F filename=image.mp4 -F [email protected] http://localhost:8080/api/upload
    """
    And k6 options:
      """
        {
          stages: [
            {
                 duration: "5m", target: 60
            },
          ],
        }
      """
    And The file name is "generated_test.js"

The feature file should have Scenario with 3 steps definitions

  1. Given step followed by curl command inside step argument
  2. And step followed by k6 script options inside step argument
  3. And step followed by generated file name inside double quote

You can modify any wording except the rules above.

Support multilple scenario inside feature file.

  • Run command
curl-to-k6 generate -s 'source_dir_of_feature_files' -o 'output_dir_of_generated_k6_script'

Example

This command below will find any feature files inside current directory and put generated k6 script inside current directory

curl-to-k6 generate -s '.' -o '.'

This command below will find any feature files inside features directory and put generated k6 script inside scripts directory

curl-to-k6 generate -s './features' -o './scripts'

# Packages

Copyright © 2022 NAME HERE <EMAIL ADDRESS> */.
this code forked from https://github.com/killlowkey/parse-curl/blob/main/parse.go with some modification.
No description provided by the author
No description provided by the author