Giter Club home page Giter Club logo

Comments (5)

h6ah4i avatar h6ah4i commented on June 3, 2024 1
  1. Sharing common API request headers used in every runbooks (and used multiple times in a runbook)

On second thought, this scenario can be covered if HTTP runner have a global-headers option mentioned in #619.

from runn.

k1LoW avatar k1LoW commented on June 3, 2024

@h6ah4i Thank you for your proposal!

I think this is a very interesting proposal.
However, I do not see any strong reason to introduce it at this time.

  1. The ability to reference other files is not an inherent feature of YAML.
  2. runn has Include runner. Some of what you want to achieve with the include runner may be possible.
  3. runn has the ability to expand environment variables. Some of what you want to achieve with the variable expansion feature may be possible. It will work especially well with anchors and aliases.
  4. Some of what you want to achieve can be accomplished by concatenating the runbook with a reference YAML file in the tmp directory before the runn is executed. It will work especially well with anchors and aliases.

This is my opinion, and I also believe that in the context of testing, it should not be too DRY. I think the features of anchors and aliases should be sufficient.

from runn.

h6ah4i avatar h6ah4i commented on June 3, 2024

Thank you for reply 🙇‍♂️

  1. The ability to reference other files is not an inherent feature of YAML.

Exactly. This is also my biggest concern.

  1. runn has Include runner. Some of what you want to achieve with the include runner may be possible.
  2. runn has the ability to expand environment variables. Some of what you want to achieve with the variable expansion feature may be possible. It will work especially well with anchors and aliases.
  3. Some of what you want to achieve can be accomplished by concatenating the runbook with a reference YAML file in the tmp directory before the runn is executed. It will work especially well with anchors and aliases.

This is my opinion, and I also believe that in the context of testing, it should not be too DRY. I think the features of anchors and aliases should be sufficient.

You are totally right too, tests should not be too DRY and the technics 2, 3 and 4 are good practices for reducing duplication of runbook contents.

The technic 4 seems like the closest thing to what I want to do, but this approach can be a huge pain if you have so many runbooks. (I am already use the technics 2 and 3.)

Situations where I would like to use the --yaml-references option are only the followings for now. These are not main interest of the tests, but I have to write them over and over again.

  1. Sharing db/api runner declarations used in every runbooks
  2. Sharing common API request headers used in every runbooks (and used multiple times in a runbook)

from runn.

k1LoW avatar k1LoW commented on June 3, 2024

Thank you!!

I do not want to put additional features directly into runn's YAML processing. I wish there was another way to do more.

If you want to make runbooks more DRY, you may want to consider using runn as a package.

  1. Sharing db/api runner declarations used in every runbooks

I have solved this by writing code that reads using runn.Runner option.

Or the --runner option might work.

  1. Sharing common API request headers used in every runbooks (and used multiple times in a runbook)

runn.Var option could be used.

from runn.

h6ah4i avatar h6ah4i commented on June 3, 2024

Yes, using runn as a Go's test helper package offers great flexibility. Even so, I love using runn as a standalone tool because it's still powerful and very handy.

Or the --runner option might work.

Thanks, I have not noticed the option! But unfortunately, it seems that it only supports runner without options (non map form in YAML format). It would be nice if we can specify YAML file(s) that contains runner setups in runbook format instead.

from runn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.