javaseleniumreportleanft

Leanft Custom Framework HTML reports are not generated


Below is my SAMPLE code in which i am trying to create a simple report using the Leanft in which i am getting on result xml file.

@Test
public void Google() throws Exception {
 Reporter.init();
    WebDriver driver = new FirefoxDriver();
    driver.get("https://www.google.com");
    Thread.sleep(4000);
   if( driver.getTitle().equalsIgnoreCase("google")){
       Reporter.reportEvent("test", "test",Status.Failed);
   }
Reporter.generateReport();
driver.quit();
} 

Solution

  • As specified in the docs, if you're going to use a custom framework you'll also need to initialize the SDK (SDK.init() and SDK.cleanup())

    E.G.

    public static void main(String [] args){
        // initialize the SDK and report only once per process
        try{
            ModifiableSDKConfiguration config = new ModifiableSDKConfiguration();
            config.setServerAddress(new URI("ws://myServerAddress:5095"));
            SDK.init(config);
            Reporter.init();
    
            //put your test code here.
    
            //Generate the report and cleanup the SDK usage.
            Reporter.generateReport();
            SDK.cleanup();
        }  catch(Exception e){
        }
    }