Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

adding support for custom templates #22

Merged
merged 4 commits into from
Oct 26, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,23 @@ e46bfc69b893b659c4db713ba2cc84f1 GET /some/other/api

### Different output formats

By default Replay Zero generates Karate `*.feature` files and outputs them to the directory Replay Zero was started in. But the `--output` flag allows you to specify the format you'd like your tests to be generated in. The created files will always following the naming format `replay_scenarios_{N}.{extension}`. Currently the supported test formats are
By default Replay Zero generates Karate `*.feature` files and outputs them to the directory Replay Zero was started in. But the `--template` or `-t` flag allows you to specify the format you'd like your tests to be generated in. The created files will always following the naming format `replay_scenarios_{N}.{extension}`. Out of the box we support below test formats

* Karate (`*.feature`)
* Gatling (`*.scala`)

Specify the output as a lowercase input to the flag:

```sh
replay-zero --output=gatling
replay-zero --template=gatling
```

You can also pass path to your own custom template (in case you dont want to use karate or gatling) to the same paramater and `--extension` or `-e` to pass extentsion of the output.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I give this PR a green light after 2 quick additions

  1. Can we mention here that the templates are following the format from the text/template package in the Go stdlib? So readers have more guidance on where to start
  2. While we're at it, let's also let them know that we support all template functions provided by Sprig (ex. "You can even extend your template's functionality with string manipulation, math operators, and more from the Sprig library"), so they don't end up re-inventing like the wheel like I originally did when this project was started!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!


E.g.

```sh
replay-zero --template=/path/to/your/custom-template --extension=java
```

## Roadmap
Expand Down