コード例 #1
0
  @BeforeClass
  public void beforeClass() throws IOException {

    // Set the DataSheet name by getting the class name
    String[] strClassNameArray = this.getClass().getName().split("\\.");
    className = strClassNameArray[strClassNameArray.length - 1];
    Environment.put("CLASSNAME", className);
    Environment.put("BROWSER", "appium");

    System.out.println("Before Class method for " + className);

    // Initiate asapDriver
    asapDriver = new Driver(Dictionary, Environment);

    // Get Env
    env = System.getProperty("envName");
    Assert.assertNotNull(env, "No Environment Parameter value received");

    // Add env global environments
    Environment.put("ENV_CODE", env);
    Assert.assertTrue(asapDriver.createExecutionFolders(), "Creating Execution Folders");
    Assert.assertTrue(
        asapDriver.fetchEnvironmentDetailsFromConfigXML(), "Fetching Environment Details");

    // Instantiate reporter
    Reporter = new Reporting(Dictionary, Environment);
    Reporter.createSummaryReport();
    Reporter.createJenkinsReport();
  }
コード例 #2
0
 @AfterClass
 public void afterClass() {
   System.out.println("After Class method for " + className);
   Reporter.closeTestSummaryReport();
   if (driver != null) {
     driver.quit();
     driver = null;
   }
 }
コード例 #3
0
  @BeforeMethod
  public void beforeMethod(Method method) throws MalformedURLException {
    String testName = method.getName();
    System.out.println("Before Method for test " + testName);
    asapDriver.getDataForTest(testName);
    Reporter.createTestLevelReport(testName);

    // Initiate WebDriver
    if (driver == null) {
      // String apkPath = Environment.get("STORAGEFOLDERPATH") + "\\apks\\PredictionGuru.apk";
      driver =
          asapDriver.getAppiumAndroidDriver(
              appPackage, appActivity, "ASUS Zenfone 5", "http://0.0.0.0:4723/wd/hub");
      driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
      Reporter.setDriver(driver);

      // Initialize Common functions
      doAction = new Wrappers(driver, Reporter);
    }
  }
コード例 #4
0
 @AfterMethod
 public void afterMethod(Method method) {
   String testName = method.getName();
   System.out.println("After Method for test " + testName);
   asapDriver.setReferenceData();
   Reporter.closeTestLevelReport(testName);
   String cmd =
       "\"C:\\Program Files (x86)\\Android\\android-sdk\\platform-tools\\adb.exe\" shell pm clear "
           + appPackage;
   System.out.println("Executing command :" + cmd);
   Generic.executeCommand(cmd);
   if (driver != null) {
     driver.close();
     driver = null;
   }
 }