Cucumber: Hooks.scenario.write("wroking but logs are not printing to the correct steps"). Logs are not printing properly to the respective stepdef

Viewed 30

I have one Hooks Class which have @Before annotation that initializes the browser and loads the URL. while running single test reports are showing properly to the stepDefinition but running in parallel reports are not being printed to the stepDefinition JVM report. I'm running 3 features file at the same time using maven-surefire plugin.

Thanks.

Code

//Hooks.java

    Hooks.java 
@Before(order = 0)
    public void getProperty(Scenario scenario) {
        Hooks.scenario=scenario;
        this.scenario = scenario;
        log.info("****LAUNCH BROWSER****");
        log.info("------------------------------------------------------------");
        log.info(""+Hooks.scenario.getName()+Thread.currentThread().getId()+"");
        log.info("------------------------------------------------------------");
        configReader = new ConfigReader();
        prop = configReader.init_prop();
    }//end of getProperty function
    

    /**
     * <b>Method:</b> to launch the Browser
     * @return LandingPage
     * @throws InterruptedException
     * @throws MalformedURLException
     */
    public  LandingPage launch_Master() throws InterruptedException, MalformedURLException {
        String browserName = prop.getProperty("browser");
        driverFactory = new DriverFactory();
        this.driver = driverFactory.init_driver(browserName);
        driverFactory.getDriver().get(prop.getProperty("URL_Master"));
        Hooks.scenario.write("Initilizing Browser..............");
        return new LandingPage(driver);
    }//end of launchBrowser_Master function

JVM report

0 Answers
Related