cucumber-reporting icon indicating copy to clipboard operation
cucumber-reporting copied to clipboard

[Featurerequest] Enable inmemory Report generation

Open FloKaemmerer opened this issue 4 years ago • 6 comments

Hi,

I'm currently using this generator within a (Springboot)-Microservice that runs in EKS (AWS Elastic Kubernetes Service) which generates html Reports from cucumber-reports that are read from a S3 Bucket. The Reports are than again uploaded to a S3 Bucket. But to do so I have to have a volume mounted for the service, which I would like to avoid.

Currently the generator uses heavily the volume:

  • The input.json is read from volume
  • Static resources are written to volume
  • multiple directories are created
  • html Files are written to volume
  • Embeddings are written to volume

This is fine when you are running as a Jenkins Plugin that has a volume available anyway.

But when using the Generator within the service the typical workflow looks something like this:

  • Read input from S3 (as byte[])
  • Write input to volume as input.json
  • Prepare output directory on volume
  • Trigger generator with Input.json file
  • (static resources, htmls and embeddings are written to the volume)
  • Read htmls and embeddings as byte[]
  • upload files to S3
  • cleanup the volume

Because of that I have two Feature requests:

  1. Trigger the generator with the input as a String, byte[] or List of Features. -> instead of passing a List of Strings (paths to the input files) to the constructor provide two methods: --> first takes the Paths --> second takes the json as String/byte[]/List of Features

  2. Add an outputhandler to the generators configuration -> Default outputhandler writes the files to the volume -> Handler can be overwritten by a custom handler --> Custom handler could upload the files directly to S3 (or what ever the user wants), without writing them to a volume

I understand that the main usecase of the generator is the usage within the Jenkins Plugins. But I believe by decoupling the generator from a physical volume it would openup a widerrange of usecases within a cloud environment.

FloKaemmerer avatar Aug 12 '20 09:08 FloKaemmerer

I added two PRs to give you an idea what i mean with the featurerequest and how they could be implemented

  • Trigger the generator with the input as a String, byte[] or List of Features. -> https://github.com/damianszczepanik/cucumber-reporting/pull/959

  • Add an outputhandler to the generators configuration -> https://github.com/damianszczepanik/cucumber-reporting/pull/958

FlorianKaemmerer avatar Aug 13 '20 12:08 FlorianKaemmerer

Interesting feature but not very popular I guess so I'm not going to implement it. I will be happy to accept PR if you like add this feature. Ideally spited into smaller pieces to speed up review process

damianszczepanik avatar Aug 15 '20 15:08 damianszczepanik

I opened two PRs. Both are basicly the all you have to do to enable the feature.

It would be great if you could review them:

Add an outputhandler to the generators configuration -> https://github.com/damianszczepanik/cucumber-reporting/pull/958

Trigger the generator with the input as a String, byte[] or List of Features. -> https://github.com/damianszczepanik/cucumber-reporting/pull/959

FlorianKaemmerer avatar Aug 17 '20 06:08 FlorianKaemmerer

@damianszczepanik Did you have any chance to take a look at the PRs?

FlorianKaemmerer avatar Aug 27 '20 10:08 FlorianKaemmerer

Briefly, so I have a few questions before deeper review:

  • inmemory is an alternative or replacement for current solution
  • later noise with changing import approach should be reverted
  • later code which is not used should be removed, not commented out
  • you can separate all changes related to javadoc and formatting (except imports) into separate PR which I will be happy to merge so then other PR will be smaller and easier to review

damianszczepanik avatar Aug 30 '20 20:08 damianszczepanik

Briefly, so I have a few questions before deeper review:

  • inmemory is an alternative or replacement for current solution

-> Its an alternative/addition to the current solution. The PR https://github.com/damianszczepanik/cucumber-reporting/pull/958 adds a List of OutputHandlers to the configuration. By default it contains one Handler that writes the files to the volume. Therefore the default behaviour stays the same. The User can add/remove handlers depending on their usecase. The PR https://github.com/damianszczepanik/cucumber-reporting/pull/959 is still a draft. Same as the first PR it does not change the current behaviour but adds new posibilities for the user.

  • later noise with changing import approach should be reverted

-> could you comment on the PRs what you mean by that?

  • later code which is not used should be removed, not commented out

-> there should only be commented out code in PR 959, which is still a draft. I was hoping for your thoughts on these snippeds of code.

  • you can separate all changes related to javadoc and formatting (except imports) into separate PR which I will be happy to merge so then other PR will be smaller and easier to review

-> there should only be a few changes to the javadoc besides the changes that describe the new/changed functionality

FlorianKaemmerer avatar Sep 01 '20 13:09 FlorianKaemmerer