question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parameterized steps

See original GitHub issue

Sometimes you have steps which repeat themselves but have constant arguments that can be determined during story definition.

For example a step which uploads a file to an S3 bucket can be parameterized by the S3 bucket it should be uploading to. The alternative would be to create a step which simply sets the context to a constant before the execution of the upload step. This is verbose and frankly unnecessary.

Suggested syntax:

class Foo:
  @story
  @arguments("file")
  def do(I):
    I.upload_to_s3.partial(bucket_name='special_files')

  def upload_to_s3(self, ctx, bucket_name='default'):
    pass

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
proofit404commented, Apr 5, 2020

The purpose of our DSL is an explanation of the business process in mostly human language. Coupling values to it is a mistake in my opinion. There is a lot of places where we could put constants in Python. Making story spec one of them isn’t what I want.

0reactions
thedrowcommented, Apr 5, 2020

Because sugar is what makes open source libraries so sweet.

Seriously though, typing less is always an objective when creating libraries.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JUnit Parameterized Test with Example using @Parameters
Steps to create a Parameterized JUnit test. Following code shows an example for a parameterized test. It tests sum() method of the ...
Read more >
Parameterized JavaScript Steps
The mabl desktop app 1.4.2 release brings major improvements to JavaScript steps! Now you can define parameters in one-time or reusable JavaScript snippets....
Read more >
Parametric Equations: Eliminating Parameters - Softschools.com
Step 1: Solve one of the parametric equations for the parameter · Step 2: Substitute the resulting expression for the parameter into the...
Read more >
4 Steps to Creating a Parameter - The Data School
4 Steps to Creating a Parameter · Step 1 – Create the Parameter · Step 2 – Show the Parameter Control · Step...
Read more >
Step Definitions - Cucumber Documentation
Suggested snippets will use your own parameter types if they match parts of your undefined step. If a color parameter type exists, Cucumber...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found