TestProject Forum

Try to disabling auto reports, and implementing our own reports, by recording steps

Hi,

I have project with appium and cucumber framework for apps. I have integrated with openSDK(v2) in testProject.
I m trying to implement my own reporting for my project by using driver.report().step("").

All my page classes are using AppiumDriver.

AppiumDriver driver;

public OnBoardingScreen(AppiumDriver<MobileElement> driver) {
	this.driver = driver;
	PageFactory.initElements(new AppiumFieldDecorator(driver), this);
}

As per the testProject, for creating report we need AndroidDriver or IOSDriver of testProject. In my project i m using AppiumDriver, i cant separate it for Android and IOS, that is the reason we are using Appium.

How can i acheive reporting for this? Can anyone please suggest something.

Thanks in advance.

Hello @roopa.j,

Create a method to create Android or iOS drivers from TestProject SDK and return them as AppiumDriver<? extends MobileElement>

import io.testproject.sdk.drivers.android.AndroidDriver;
import io.testproject.sdk.drivers.ios.IOSDriver;

public AppiumDriver<? extends MobileElement> getDriver(String driverType) throws Exception {
    switch (driverType) {
        case "Android":
            return new AndroidDriver<>("dev_token", new DesiredCapabilities(), "project name");
        case "iOS":
            return new IOSDriver<>("dev_token", new DesiredCapabilities(), "project name");
        default:
            throw new Exception("driverType didn't match any driver");
    }
}

Now you can use AppiumDriver that can be cast to TP ReportingDriver

((ReportingDriver)driver).report().disableTestAutoReports(true);
((ReportingDriver)driver).report().disableCommandReports(true);

Great, It worked.

I have tried same way, but i dint cast to ReportingDriver. Thanks for saving my time :slight_smile: