简体   繁体   English

AWS设备场:APPIUM_JAVA_JUNIT_TEST_PACKAGE_CLASS_FILE_MISSING_IN_TESTS_JAR

[英]AWS Device Farm: APPIUM_JAVA_JUNIT_TEST_PACKAGE_CLASS_FILE_MISSING_IN_TESTS_JAR

I am trying to upload Appium Java JUnit tests to AWS Device Farm. 我正在尝试将Appium Java JUnit测试上传到AWS Device Farm。 I configured my pom.xml file like this: 我这样配置了pom.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<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.acme</groupId>
   <artifactId>acme-android-appium</artifactId>
   <version>1.0-SNAPSHOT</version>
   <packaging>jar</packaging>
       <repositories>
            <repository>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
                <checksumPolicy>fail</checksumPolicy>
            </releases>
            <id>Experitest.repo1</id>
            <name>YourName</name>
            <url>https://cloud.experitest.com/repo/</url>
            <layout>default</layout>
        </repository>
    </repositories>
   <build>
      <sourceDirectory>src</sourceDirectory>
      <plugins>
         <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
               <source>1.8</source>
               <target>1.8</target>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <classesDirectory>dummy</classesDirectory>
            </configuration>
            <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>
            <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/assembly/zip.xml</descriptor>
                     </descriptors>
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
   <dependencies>
      <dependency>
         <groupId>com.amazonaws</groupId>
         <artifactId>aws-lambda-java-core</artifactId>
         <version>1.1.0</version>
      </dependency>
      <!-- extentreports -->
      <dependency>
         <groupId>com.relevantcodes</groupId>
         <artifactId>extentreports</artifactId>
         <version>2.41.2</version>
      </dependency>
      <dependency>
         <groupId>com.experitest</groupId>
         <artifactId>appium</artifactId>
         <version>4.1.2</version>
      </dependency>
   </dependencies>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
</project>

When I am trying to compile my code by maven (through CMD with this command: mvn clean package -DskipTests=true ) I got some info rows including this information: 当我尝试通过maven编译代码时(使用以下命令通过CMD: mvn clean package -DskipTests = true ),我得到了一些信息行,其中包括以下信息:

[WARNING] /C:/Users/Adam Peretz/workspace/Sweetch/src/Utilites/CommonOps.java: Some input files use unchecked or unsafe operations. [警告] / C:/ Users / Adam Peretz / workspace / Sweetch / src / Utilites / CommonOps.java:某些输入文件使用未经检查或不安全的操作。

[WARNING] /C:/Users/Adam Peretz/workspace/Sweetch/src/Utilites/CommonOps.java: Recompile with -Xlint:unchecked for details. [警告] / C:/ Users / Adam Peretz / workspace / Sweetch / src / Utilites / CommonOps.java:使用-Xlint:重新编译:未经检查,以获取详细信息。

[WARNING] JAR will be empty - no content was marked for inclusion! [警告] JAR将为空-未标记任何内容!

[INFO] BUILD SUCCESS [INFO]建立成功

and after it, I uploaded the " zip-with-dependencies.zip " file to AWS Device Farm and got this error: 然后,我将“ zip-with-dependencies.zip ”文件上传到AWS Device Farm并出现以下错误:

There was a problem processing your file. 处理您的文件时出现问题。 We could not find a class file within the tests JAR file. 我们在测试JAR文件中找不到类文件。 Please unzip your test package and then unjar the tests JAR file, verify that at least one class file is within the JAR file, and try again. 请解压缩测试包,然后解压缩测试JAR文件,确认JAR文件中至少有一个类文件,然后重试。 For more information about this issue, please see the documentation . 有关此问题的更多信息,请参阅文档

What should I do? 我该怎么办? I really don't know what to do, I tried everything. 我真的不知道该怎么办,我尝试了一切。

Where did you put the Java files? 您将Java文件放在哪里? The warning relates back to the jar file that's created by default in maven and not the *-test.jar 该警告与默认情况下在maven中创建的jar文件有关,而不是* -test.jar。

Device Farm uses the *-test.jar file and the error message suggests that it is empty. 设备场使用* -test.jar文件,并且错误消息表明该文件为空。 Are the test Java files under ./src/test/java? 测试Java文件是否位于./src/test/java下? If not they will need to be otherwise maven will not package those class files into the *-test.jar. 如果不是这样的话,否则maven不会将这些类文件打包到* -test.jar中。

Here is an example to compare with. 这是一个比较的例子。

https://github.com/aws-samples/aws-device-farm-appium-tests-for-sample-app https://github.com/aws-samples/aws-device-farm-appium-tests-for-sample-app

Hope that helps 希望能有所帮助

James 詹姆士

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AWS Device Farm:* -tests.jar文件是在测试包中的zip文件之后构建的 - AWS Device Farm: *-tests.jar file is built after the zip file in the test package Java Appium Test无法在AWS Device Farm上运行 - Java Appium Test failed to run on AWS Device Farm Appium Java JUNIT-“我们找不到* -tests.jar文件”-AWS - Appium Java JUNIT - “We could not find a *-tests.jar file” - AWS AWS设备场使用TestNG框架,而不管选择Appium Java Junit进行测试 - AWS-Device farm Uses TestNG Framework Regardless of selecting Appium Java Junit for Testing 从测试jar运行JUnit测试时找不到类异常 - Class Not Found Exception When Running JUnit Tests from test jar AWS设备场上的Appium / TestNG脚本-找不到元素 - Appium/TestNG script on AWS device farm - could not find element 带有junit的Java类路径和包中的测试类 - java classpath with junit and test class inside a package 如何使用JUnit在Java中设计Appium测试 - How to design Appium tests in Java using JUnit AWS Device Farm + Espresso:在AWS Device Farm中运行涉及本机JNI方法调用的Espresso Instrumentation测试 - AWS Device Farm + Espresso: Running Espresso Instrumentation Test involving Native JNI method call in AWS Device Farm 尝试使用 Java SDK 将文件放入 AWS Device Farm 时出现“无效的应用程序上传” - "Invalid application uploaded" when trying to put file to AWS Device Farm using Java SDK
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM