Junit测试未在AWS上运行。仅设置和拆卸有效

时间:2019-10-02 10:59:59

标签: java amazon-web-services junit appium junit5

我正在对AWS设备场服务上的iOS应用进行自动化测试。我的测试类在本地成功运行,但是当我在aws设备场服务器上运行时,只有三个内置的测试用例运行,即安装套件,测试套件和TearDown套件。我上传了zip依赖项文件,但无法正常工作。 这是我的测试课...

public class TesClass {
String appiumPort = "4723";
String serverIp = "0.0.0.0";
static IOSDriver < IOSElement > driver;
LoginPage lPage = null;
DesiredCapabilities cap;
ProgrammesPage p_page = null;
MainPage mPage = null;

@Test
@Order(1)
@DisplayName("Verify that all three  text fields and login button is present in the login page")
void test() throws MalformedURLException {
    cap = new DesiredCapabilities();

    cap.setCapability("deviceName", "Muhammad’s iPhone");
    cap.setCapability("platformName", "iOS");
    cap.setCapability("platformVersion", "12.1.2");
    cap.setCapability("automationName", "XCUITest");
    cap.setCapability("app", "/Users/ahmsam/Downloads/MainApp-2.ipa");
    cap.setCapability("xcodeOrgId", "BNL4VQ2576");
    cap.setCapability("xcodeSigningId", "iPhone Developer");
    cap.setCapability("udid", "240476512a6dd29a2f82fc8211ef4ea1bf6b5891");
    // cap.setCapability("udid","3c7ad82d510561a572d459cab855154cd578e3da");
    cap.setCapability("updateWDABundleId", "5SN9XXLNWB.uk.org.humanfocus.WildCard.Dev");

    String serverUrl = "http://" + serverIp + ":" + appiumPort + "/wd/hub";
    driver = new IOSDriver < IOSElement > (new URL(serverUrl), cap);
    driver.manage().timeouts().implicitlyWait(55, TimeUnit.SECONDS);

    lPage = new LoginPage(driver);
    lPage.firstThreePopoClick();
    boolean check = lPage.validateLoginpage();

    // = lPage.loginTestCase();

    Assert.assertTrue(check);
    //fail("Not yet implemented");
}

@Test
@Order(2)
@DisplayName("Verify that user successfully logins with correct credentials")
void test1() {
    lPage = new LoginPage(driver);

    boolean check1 = lPage.TestdoLoginWIthValues();

    Assert.assertTrue(check1 == true);

}

}

这是我的pom.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>com.hft.sammar</groupId>
<artifactId>AppiOSTests</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>AppiumScalaJUnit</name>
<url>http://maven.apache.org</url>
<properties>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <junit.jupiter.version>5.4.0</junit.jupiter.version>
</properties>
<dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>${junit.jupiter.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${junit.jupiter.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>7.2.0</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.5.0</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.5.0</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.5.0</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.4</version>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <goals>
                        <goal>test-jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.10</version>
            <!--$NO-MVN-MAN-VER$-->
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.5.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <finalName>zip-with-dependencies</finalName>
                        <appendAssemblyId>false</appendAssemblyId>
                        <descriptors>
                            <descriptor>src/main/java/assembly/zip.xml</descriptor>
                        </descriptors>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

如果我的pom.xml文件有问题?请告诉我。 我正在使用junit 5.4.0。

0 个答案:

没有答案