• maven+testng+appium中的pom.xml和testng.xml文件


    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
    
      <groupId>dd</groupId>
      <artifactId>maventtest</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>jar</packaging>
    
      <name>maventtest</name>
      <url>http://maven.apache.org</url>
    
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>
    
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
        
        <dependency>
                <groupId>org.uncommons</groupId>
                <artifactId>reportng</artifactId>
                <version>1.1.4</version>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.testng</groupId>
                        <artifactId>testng</artifactId>
                    </exclusion>
                </exclusions>
         </dependency>
         
         <dependency>
                <groupId>io.appium</groupId>
                <artifactId>java-client</artifactId>
                <version>2.1.0</version>
         </dependency>
            
      </dependencies>
    </project>

    testng.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <suite name="Suite" parallel="false">
      <test name="Test">
        <classes>
          <class name="dd.maventtest.NewTest"/>
        </classes>
      </test> <!-- Test -->
      
       <listeners>
            <listener class-name="org.uncommons.reportng.HTMLReporter" />
            <listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
        </listeners>
        <usedefaultlisteners name="false" />
        
    </suite> <!-- Suite -->
    package maventest.firsttest1;
    
    import io.appium.java_client.AppiumDriver;
    import io.appium.java_client.android.AndroidDriver;
    
    import org.openqa.selenium.remote.DesiredCapabilities;
    import org.testng.annotations.AfterClass;
    import org.testng.annotations.BeforeClass;
    import org.testng.annotations.Test;
    import org.testng.annotations.BeforeMethod;
    import org.testng.annotations.AfterMethod;
    
    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.net.URL;
    
    public class NewTest {
        AndroidDriver driver;
      @Test
      public void f() throws Exception {
          Thread.sleep(2000);
      }
      @BeforeClass
      public void beforeMethod() throws IOException {
          DesiredCapabilities capabilities = new DesiredCapabilities();
          capabilities.setCapability("platformName", "Android");
          capabilities.setCapability("platformVersion", "4.4");
          capabilities.setCapability("deviceName","Android Emulator");
          capabilities.setCapability("appPackage", "com.android.contacts");
          capabilities.setCapability("appActivity", ".activities.AuroraPeopleActivity");
          driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
      }
    
      @AfterClass
      public void afterMethod() {
          driver.quit();
      }
    
    }
  • 相关阅读:
    GDB的启动方式
    【linux】基础1
    web安全实战折腾系列-对应B站视频
    白帽子讲web安全笔记-对应B站视频
    DNF搬砖号打造【只适合100级的版本】
    阿里云的开发者社区测试
    OWASP安全测试指南-OTGv4
    第8章 VLAN
    web安全简介与环境配置-反射型XSS-存储型XSS-XSS进阶-sql注入基础
    xss攻防
  • 原文地址:https://www.cnblogs.com/penghong2014/p/4380199.html
Copyright © 2020-2023  润新知