[SpecFlow+ LivingDoc] Add a parameter to attach base64 String image on the Specflow ISpecFlowOutputHelper
Add a parameter to attach base64 String image on the Specflow ISpecFlowOutputHelper
-
Hi Jonathan,
thanks a lot for taking the time and sending us your request.
Are you referring to the new SpecFlow Output API and would like to view the base 64 string directly as an image in SpecFlow+ LivingDoc?
0 -
Yes, I work with Extent reports as well and I don't need to create real images and store them in some folder to do attachment on extent reports, I just create a base64 string image with selenium driver and send to attach reports for the image to be renderer inside the HTML document like this:
public MediaEntityModelProvider GetScreenshot(IWebDriver webDriver)
{
var screenshot = ((ITakesScreenshot)webDriver).GetScreenshot().AsBase64EncodedString;
return MediaEntityBuilder.CreateScreenCaptureFromBase64String(screenshot).Build();
}_scenario.CreateNode<Then>(scenarioContext.StepContext.StepInfo.Text).Fail(scenarioContext.TestError.Message, GetScreenshot(webDriver));
This will help to improve living doc API for pipeline tests purpose
0 -
We discussed this topic when we developed the feature and decided against this. The reason was, that this would generate a very big TestExecution.json file, which will bring us more problems.
1. Storage in Azure DevOps is limited. We would quickly reach the limit that would be possible to save in Azure DevOps for Extensions
2. Time for parsing the JSON file is increasing. Some of our users have already very big Living Documentations and have a loading time of multiple seconds
But that doesn't mean, that we see improvement in this area to make it easier to share a Living Documentation with images.
We will start with some examples for various Combinations (Build system, Image Storage, ...) how to do it.
What are you using? Then we can prioritize the combinations first which are used out there.
0 -
We are not using azure to store images, we are curently working with two different reports, we have integrated Living doc on our azure DevOps and sometimes we run locally to generate the extent reports with attached images.
But we are on the way to work only with Specflow.
If you give me another solution to share the failure screenshots using Living Doc on azure I'll aprecciate.
1 -
I would like to join to Jonathan's request - embedding of screenshots in Living Docs captured during test execution on remote server would be a nice feature (since SpecRunner doesn't support this one yet).
2 -
Jonathan Pereira & Piotr Niedzialek (PL): We published a guide for uploading the images to Azure Blogstorage with Azure DevOps at https://docs.specflow.org/projects/specflow-livingdoc/en/latest/Guides/azureblobstorage.html
Please let us know if this helps you.
0 -
As someone who also has used Extent report, I have to agree that attaching a base 64 image in the living doc would be very nice and much better than the current options. With Extent HTML report, you are able to send the HTML file that has the 64-bit image embedded in it and there is no need to also send images with it. With LivingDoc you have to give a path to the image and even if you share the HTML report with the images folder the link in the report will be broken since the image path is relative to my system that generated the report. since this is an issue of braking azure is there no way to get base 64 images from a locally generated report?
2 -
Hi Andreas Willich, looking at your example at https://docs.specflow.org/projects/specflow-livingdoc/en/latest/Guides/azureblobstorage.html I understand what you are doing but what I don't get how you are using specFlowOutputHelper.AddAttachment() since it only accept filepath so I am confused to see in your example that you are suing Url?
I tried to attach a publicly available image (google logo _specFlowOutputHelper.AddAttachment("https://blog.hubspot.com/hubfs/image8-2.jpg"); ) but as expected an exception is thrown when checking whether File exists in TestContext(ln 314)
Using SpecFlow.Nunit 3.9.74 & SpecFlow.Plus.LivingDocPlugin 3.9.57
What am I missing?
0 -
Martin Copjan You see the exception?
Because we catch-all and fallback to a simple output with a link to the file.
0 -
Just going to add to OP request as an extent reporter user i would really like to see the base 64 image upload added as an option.
I don't normally have large amounts of failing tests as the run would fail if failing tests were above n% threshold and having the ability to combine multiple test execution reports, at least in the CLI, perhaps you can do a rolling test execution or split it by feature or some other brilliant solution. I am currently playing with living doc to see if i can replace extent and this is one of the areas it fall short compared with extent.
Thanks1
Please sign in to leave a comment.
Comments
10 comments