Writing log and screenshot in Cucumber Report

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

ความคิดเห็น • 24

  • @rajeshkumarsharma8100
    @rajeshkumarsharma8100 2 ปีที่แล้ว +1

    Thanks Niraj it worked for me....

  • @NirajGupta
    @NirajGupta  ปีที่แล้ว

    with io.cucumber jar we have scenario.attach(screenshot, "image/png","first") for attaching screenshot
    for attaching text to scenario scenario.attach("Text key:", " text/plain"," Random String");

  • @NirajGupta
    @NirajGupta  5 ปีที่แล้ว +1

    GIt Hub Url-github.com/callnirajgupta/ExtendsAndLogInCucumber/tree/master/SampleSeleniumProject

  • @TestTactix
    @TestTactix 3 ปีที่แล้ว

    That's very helpful.

  • @mizanur968
    @mizanur968 3 ปีที่แล้ว +1

    Hi Niraj, thanks for this amazing video, I have implemented this in the page object method level which works fine if I run single test but having issues when i run parallel execution, scenario.log is getting added to different scenario, how to resolve this?

    • @NirajGupta
      @NirajGupta  3 ปีที่แล้ว

      Are you capturing the scenario name in global variable.use @After and use the global scenario and then log the logger

    • @mizanur968
      @mizanur968 3 ปีที่แล้ว

      yes, I have captured in public static Scenario sceanio; then initialize that in @before method as ClassName.scenario = scenaio. and also used in @after method as ClassName.scenario = scenario, then used in the pageObject methods as ClassName.scenario.write("bla bla"). Now when I execute in parallel, "bla bla" is getting added to the cucumber report but with incorrect scenario, did i make any mistak?

    • @NirajGupta
      @NirajGupta  3 ปีที่แล้ว

      @@mizanur968 Are you using single tton framework...parallel execution work well when you are making single object for wriver through the test execution

  • @MrRanjitray
    @MrRanjitray 3 ปีที่แล้ว

    Hi Niraj, Thanks a lot for a great video. I am using javascript. I want to implement the same kind of report. Current feature file text is getting reflected in the report. Wat to put the logger.info from the script message in the Report. Could you please help. ?
    Or can you create a video for this.

  • @sanjeets93
    @sanjeets93 4 ปีที่แล้ว

    Hi Niraj,
    Is there a way to upload screenshot for individual BDD steps in cucumber report.

    • @NirajGupta
      @NirajGupta  4 ปีที่แล้ว

      Yes.You can embed the screen shot after each step finished. or you can use extend report also.Please check my extend report video. or you can use io.cucumber jar in place of info.cukes cucumber jar. check @Afterstep anotation

  • @swagatikarath4399
    @swagatikarath4399 2 ปีที่แล้ว

    After writing private static logger which package we are importing??

    • @NirajGupta
      @NirajGupta  2 ปีที่แล้ว

      import org.apache.log4j.Logger;

  • @sureshkumarsekar5156
    @sureshkumarsekar5156 2 ปีที่แล้ว

    Showing this error - java.lang.NullPointerException: Cannot invoke "io.cucumber.java.Scenario.log(String)" because "apphooks.CommonStep.scenario" is null how to rectify it

  • @therawscholar
    @therawscholar 5 ปีที่แล้ว

    Can you please share the above project.

    • @NirajGupta
      @NirajGupta  5 ปีที่แล้ว

      github.com/callnirajgupta/ExtendsAndLogInCucumber/tree/master/SampleSeleniumProject

  • @shikharohilla4118
    @shikharohilla4118 4 ปีที่แล้ว

    scenario.write("") is not printing message from step defintion, its working from coomon steps

    • @shikharohilla4118
      @shikharohilla4118 4 ปีที่แล้ว

      I am getting null pointer exception for scenario.write() from common steps and from step def also its not giving any exception but still not printing in report. could you please suggest

    • @NirajGupta
      @NirajGupta  4 ปีที่แล้ว

      You need to pass scenario object from common step

    • @NirajGupta
      @NirajGupta  4 ปีที่แล้ว

      first you should assign scenario object to public variable in commonstep and then refer that same variable in step.scenario.write("Hello cucumber
      ")

    • @diwakarkumar2758
      @diwakarkumar2758 4 ปีที่แล้ว

      Log4j we have to use or not

    • @NirajGupta
      @NirajGupta  4 ปีที่แล้ว

      @@diwakarkumar2758 it's up to you .If you want to user logger for your debuging then use logger.else skip it

  • @dinesh406
    @dinesh406 ปีที่แล้ว

    scenario. write() method not showing..
    I mean no write method. Its showing getName() and wait() , attach() method its showing?

    • @NirajGupta
      @NirajGupta  ปีที่แล้ว

      Yes with io.cucumber jar we have scenario.attach(screenshot, "image/png","first") for attaching screenshot
      for attaching text to scenario scenario.attach("Text key:", " text/plain"," Random String");