You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.
Implementing Appium grid when am performing parallel execution the application and catching null pointer exception
Summary
Expected Behavior
Current Behavior
It was working perfectly when I was working to execute single test case but when am doing the same for parallel it's throwing me null pointer exception
Sample
// Sample code goes here
public class AppiumTestBase {
public static final Logger log = Logger.getLogger(AppiumTestBase.class.getName());
static AppiumDriverLocalService services;
public static AndroidDriver<MobileElement> driver;
public static String destDir;
public static String srcPath;
Capablities caP;
static AppiumServer aS;
public static ExtentReports extent;
public static ExtentTest test;
public ITestResult result;
public static String newFileName;
public ExtentReports reo =ExtentManager.getInstance();
public static ExtentTest tst;
@AfterClass(alwaysRun = true)
public void endTest() {
extent.endTest(test);
extent.flush();
}
public void reportLog(String message) {
captureScreen("");
test.log(LogStatus.INFO, message+ test.addScreenCapture(newFileName));// at this ponit am getting nullpointer execption
log.info("Message: " + message);
Reporter.log(message);
}
}
This is my test case
public class Test_FireCart_Dashboard_module extends AppiumTestBase{
Dashboard_module dM;
@Test(priority = 1)
public void testMenuFunctionality() throws InterruptedException {
try {
dM = new Dashboard_module(driver);
PageFactory.initElements(new AppiumFieldDecorator(driver), dM);
reportLog("Verify Fire Cart Application is launched");
dM.signUp_with_google();
dM.googleacc();
reportLog("Verify Sign in with google button is clicked");
new WebDriverWait(driver, 1000l)
.until(ExpectedConditions.visibilityOfElementLocated(By.id("com.hitesh_sahu.retailapp:id/header")));
reportLog("Verify user sucessfully login to Fire Cart dashboard");
dM.clickOnMenu();
reportLog("Verify menu button is clicked");
for(int i =2;i<=6;i++) {
reportLog("Verify user clicked" + dM.clickMenuItems().get(i).getText());
dM.clickMenuItems().get(i).click();
dM.clickOnBack();
dM.clickOnMenu();
}
new WebDriverWait(driver, 1000l)
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@text='Logout']")));
dM.clickOnLogout();
reportLog("Verify Logout option is clicked");
} catch (Exception e) {
reportLog("Failed to launch Fire cart application");
}
try {
String act_text = HardAssertions.textassertion(dM.validateLoginScreen());
Assert.assertEquals(act_text, "LOGIN");
} catch (Exception e) {
captureScreen("");
test.log(LogStatus.FAIL, "Filed to logout from Fire cart dashbord", test.addScreenCapture(newFileName));
}
}
Environment Details
Extent report Version used: 2.41.2
Operating System and version: Windows 10 pro
JDK Version: java version "1.8.0_161"
Screenshots
java.lang.NullPointerException
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Implementing Appium grid when am performing parallel execution the application and catching null pointer exception
Summary
Expected Behavior
Current Behavior
It was working perfectly when I was working to execute single test case but when am doing the same for parallel it's throwing me null pointer exception
Sample
// Sample code goes here
public class AppiumTestBase {
static {
Calendar calendar = Calendar.getInstance();
SimpleDateFormat formater = new SimpleDateFormat("dd_MM_yyyy_hh_mm_ss");
extent = new ExtentReports(System.getProperty("user.dir") + "\target\surefire-reports\html\"+ formater.format(calendar.getTime()) + ".html", false);
public String captureScreen(String fileName) {
if (fileName == "") {
fileName = "blank";
}
File destFile = null;
Calendar calendar = Calendar.getInstance();
SimpleDateFormat formater = new SimpleDateFormat("dd_MM_yyyy_hh_mm_ss");
File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
try {
String reportDirectory = new File(System.getProperty("user.dir")) + "\target\surefire-reports\html\";
public void log(String data) {
log.info(data);
Reporter.log(data);
}
public void getresult(ITestResult result) {
if (result.getStatus() == ITestResult.SUCCESS) {
test.log(LogStatus.PASS, result.getName() + "test is pass");
captureScreen("");
test.log(LogStatus.PASS, test.addScreenCapture(newFileName));
// @BeforeMethod()
// public void beforeMethod(Method result) throws MalformedURLException {
//AppiumServer.start();
//driver =Capablities.setAndroidCapablities(driver);
}
This is my test case
public class Test_FireCart_Dashboard_module extends AppiumTestBase{
Environment Details
Screenshots
java.lang.NullPointerException
The text was updated successfully, but these errors were encountered: