selenide-examples / selenide-allure-junit

94 stars 49 forks source link

How to add custom step that the step details is the URL #8

Closed ansonliao closed 4 years ago

ansonliao commented 4 years ago

Dear @asolntsev , I running Allure with Selenide in Gradle against Selenoid browser hub, as you know, Selenoid provide the video recording function, so I would like to attach the video URL when the test case failed in allure. From the sample: https://github.com/allure-framework/allure-java/blob/b600f7b1d9fbbf81a8efa1f072d0af218530eb46/allure-selenide/src/test/java/io/qameta/allure/selenide/AllureSelenideTest.java#L70-L77

and my code is in @AfterMethod of TestNG:

SelenideLog log = SelenideLogger.beginStep("testing", "\nTest video: " + videoUrl + "\nTest logs: " + logUrl);
                SelenideLogger.commitStep(log, LogEvent.EventStatus.FAIL);

and finally, I got the report layout is: image

it looks not good, could you advise how I can present the video link/log link better? Thanks.

asolntsev commented 4 years ago

Could you please specify what means "looks not good"? What exactly do you expect to improve?

ansonliao commented 4 years ago

could I remove SelenideLogger#beginStep 's the first parameter source: $("testing"), and the log content can be parsed \n, for example, the test video and test log can be in new line:

Test video: http://...
Test logs: http://

thanks

asolntsev commented 4 years ago

@ansonliao In the first comment you mentioned that this is your code:

SelenideLog log = SelenideLogger.beginStep("testing", "\nTest video: " + videoUrl + "\nTest logs: " + logUrl);

So why you cannot just remove "testing" and "\n" from your code?

ansonliao commented 4 years ago

@asolntsev When I removed "testing" from SelenideLogger#beginStep:

image

When I updated my code for SelenideLogger#beginStep) to

SelenideLog log = SelenideLogger.beginStep("Test video: ", videoUrl + " Test logs: " + logUrl);
SelenideLogger.commitStep(log, LogEvent.EventStatus.FAIL);

finally got: image

asolntsev commented 4 years ago

@ansonliao Sure, because method beginStep needs at least 2 arguments.

Actually, it seems to be a misusage of SelenideLogger. Method beforeStep should be called before some action, but you are calling it after.

I recommend to look at Allure Selenide sources - it already can add browser logs to Allure report. I believe you can add videos in the same manner.

ansonliao commented 4 years ago

@asolntsev you still don't get what I mention, anyway, let it go. thanks for your help.

asolntsev commented 4 years ago

@ansonliao The only way to make me understand you is to explain :)

ansonliao commented 4 years ago

Hi @asolntsev , my solution is wrong, maybe can override the AllureSelenide#afterEvent to provide more extra failure information? https://github.com/allure-framework/allure-java/blob/master/allure-selenide/src/main/java/io/qameta/allure/selenide/AllureSelenide.java#L130

thanks.

asolntsev commented 4 years ago

@ansonliao I don't know. I have almost zero experience with Allure. :( I recommend to send a question/issue to Allure chat/github.

ansonliao commented 4 years ago

Sure, thanks @asolntsev

ansonliao commented 4 years ago

Hi @asolntsev could you help to solve my problem from the issue of my repo about the Configuration setting of Selenide? I don't want to open an issue in the repo of Selenide to trouble the regular development issue of Selenide. Thanks.

https://github.com/ansonliao/Selenium-RottenTomatoes/issues/1

asolntsev commented 4 years ago

@ansonliao Sure, I will take a look.