Questo contenuto non è disponibile nella lingua selezionata
Lavoriamo costantemente per rendere disponibili i contenuti nella lingua selezionata. Ti ringraziamo per la comprensione.
How do I add the testng.xml file to the root of the *-tests.jar file in my Appium Java TestNG test package for AWS Device Farm?
3 minuti di lettura
I want to configure Appium Java TestNG tests for my AWS Device Farm project. However, I need to add a testng.xml file into the root of the *-tests.jar file in my Appium test package first. How do I do that?
Any TestNG parameters defined in your testng.xml file
1. In your Apache Maven pom.xml file, verify that the testResources tag includes the following directory: src/test/resources. If you don't see the directory, add the following directory configuration to the file:
Note: It's a best practice to run tests locally before uploading projects to Device Farm. The Maven Surefire plugin allows your pom.xml file to reference your testng.xml file during local tests.
4. Clean your pom.xml file's target directory and repackage your test files by running the following Maven command:
$ mvn clean package -DskipTests=true
Note: The DskipTests=True value specifies that the build won't run the unit tests.
The command creates a zip-with-dependencies.zip file in your pom.xml file's target directory. This zip file is your Appium test package and includes your testng.xml file in the root of its *-tests.jar file.
5. Verify that your testng.xml file is in the root of your Appium test package's *-tests.jar file by running one of the following commands:
To see a snapshot of files in your *-tests.jar file, run the following jar command:
$ jar tvf foo-1.0.0-SNAPSHOT-tests.jar
To extract all of the files in your *-tests.jar file into a folder, run the following unzip command: