nficano / python-lambda

A toolkit for developing and deploying serverless Python code in AWS Lambda.
ISC License
1.5k stars 229 forks source link

Testing multiple events together #636

Open dominusmi opened 3 years ago

dominusmi commented 3 years ago

I was thinking that it would be very useful to be able to test multiple events in a row instead of just one, like a test battery. Of course I could just write a simply script on my local machine, but it sounds like an interesting feature to add to the library.

In order to keep the events separate (so that you can also unit test), I was thinking of a command to invoke all events in a directory for example. I'd even say that it should be the default behaviour of lambda invoke, since having only one event.json isn't a very useful feature. In this case, lambda init would create an events directory, with inside a single default event.json, in order to make the transition as clean as possible for future users.

lambda invoke would then by default run all the events sequentially, and would still accept the filename parameter to only run one event

I'd be open to make a PR for this when I get the time if we can agree on the structure

bot2x commented 2 years ago

Hey. This is a really good suggestion as a feature. For most lambda, I have multiple copies of event.json renamed with numbers attached.

bot2x commented 2 years ago

@nficano Thoughts ?