score:1
have you considered using a build tool like maven for your project? it designed to do exactly what your asking. all of your project configuration is contained within one file. your tests are more portable and it allows for easy execution of your test scripts anywhere.
here is a basic example pom.xml configuration file:
<?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>groupname</groupid>
<artifactid>artificatid</artifactid>
<version>0.0.2</version>
<name>selenium tests</name>
<properties>
<!-- compiler settings -->
<maven.compiler.sources>1.8</maven.compiler.sources>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- build info -->
<build.timestamp>${maven.build.timestamp}</build.timestamp>
<project.build.sourceencoding>utf-8</project.build.sourceencoding>
<testng.congig>${testsuite}</testng.congig>
<aspectj.version>1.8.9</aspectj.version>
<allure.version>1.4.14</allure.version>
</properties>
<dependencies>
<dependency>
<groupid>org.testng</groupid>
<artifactid>testng</artifactid>
<version>6.8.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupid>ru.yandex.qatools.allure</groupid>
<artifactid>allure-testng-adaptor</artifactid>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupid>org.seleniumhq.selenium</groupid>
<artifactid>selenium-java</artifactid>
<version>3.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupid>org.apache.maven.plugins</groupid>
<artifactid>maven-compiler-plugin</artifactid>
<version>3.1</version>
<configuration>
<source>${maven.compiler.sources}</source>
<target>${maven.compiler.target}</target>
<encoding>${project.build.sourceencoding}</encoding>
<showwarnings>true</showwarnings>
<showdeprecation>true</showdeprecation>
</configuration>
</plugin>
<plugin>
<groupid>org.apache.maven.plugins</groupid>
<artifactid>maven-surefire-plugin</artifactid>
<version>2.18.1</version>
<configuration>
<argline>
-javaagent:${settings.localrepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
</argline>
<suitexmlfiles>
<suitexmlfile>target\test-classes\${testng.congig}</suitexmlfile>
</suitexmlfiles>
</configuration>
<dependencies>
<dependency>
<groupid>org.aspectj</groupid>
<artifactid>aspectjweaver</artifactid>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/test/resources</directory>
<includes>
<include>*.xml</include>
</includes>
</resource>
</resources>
</build>
<reporting>
<excludedefaults>true</excludedefaults>
<plugins>
<plugin>
<groupid>ru.yandex.qatools.allure</groupid>
<artifactid>allure-maven-plugin</artifactid>
<version>2.2</version>
</plugin>
</plugins>
</reporting>
</project>
executing your script from the command line is as easy as:
mvn -fn clean install -dtestsuite=your_test_suite.xml
maven is highly configurable and allows you to setup your projects as you like.
heres a more detailed explanation: http://toolsqa.com/java/maven/configure-selenium-continuous-integration-maven/
Source: stackoverflow.com
Related Query
- Running compiled Java Selenium tests (with dependencies) using TestNG xml via command line
- How to run Selenium Java tests with TestNG programmatically?
- Error occurred during initialization of boot layer java.lang.module.FindException executing Selenium tests using TestNG and Java 12 through Eclipse
- Can not Running Selenium with Eclipse with Java and BDD using Chrome or Firefox
- Trying to remotely compile, using the command line, a Java program with multiple dependencies that I can currently only compile locally in Eclipse
- How to click a button in Selenium WebDriver with Java using jQuery
- My JUnit tests executes with maven build in Java 11, but unable to run same Junit tests via RunIT->Run As->Units, which always says not JUnits found
- Insert data into MySQL from Excel via Eclipse using Selenium and Testng
- Error using xml libraries inside gradle plugin with java 11
- Using switch() with Scanner in Java error when running with Pico Compiler- Ipad
- Running a java jar with eclipse swt dependencies with maven-dependency-plugin
- Unable to locate and switch to iframe using Eclipse with Selenium webdriver Java
- Running Eclipse JUnit Tests with Gradle Builds of Modular Java (JavaFX) Projects that can also generate executable images with Jlink
- I've set up a simple automation framework in Eclipse using Java but cannot run Cucumber tests via Junit
- Running JUnit tests on multiple browsers with Selenium
- Unexpected pop window handling while running script in selenium web driver using java
- How to navigate to nth page in pagination using Selenium WebDriver with java
- How to export a single Java Class with its dependencies using Eclipse?
- ClassNotFoundException error is displayed in the console when i tried to launch chrome browser using selenium with java
- Java code compiled using an older JDK will not work properly with a newer JRE/JVM
- Am using selenium with java for automating web based application. I couldnt interact with browse button
- Multiple contexts with the same path error running web service in Eclipse using Tomcat
- How to downgrade Java from 9 to 8 on a MACOS. Eclipse is not running with Java 9
- Eclipse/Maven: JUnit tests not compiled when running them
- Running Gradle project via Eclipse errors "system Cannot find System Java Compiler"
- Running Eclipse Junit Plugin tests with Junit 4.4 or newer -- why aren't tests detected?
- Issues with maven project running in eclipse, not recognized as Java project
- Can I avoid running junit tests twice in eclipse when using a TestSuite?
- Running JUnit tests with Maven under Eclipse
- Using JUnit 5 with Java 9 without Maven or Gradle
More Query from same tag
- How to generate only one editor for more models in EMF?
- Error in Assigning proper home directory while configuring jboss-eap-6.4 server in Eclipse Luna
- How to import GAE java project (with maven) in Eclipse?
- unfortunately <app name> has stopped
- How do you connect postgres to heroku through eclipse?
- Eclipse Neon + JBossTools + Maven results on error: No compiler is provided in this environment
- Java / Eclipse: Removing multiple warnings for 'Unnecessary @SuppressWarnings'
- Type Dynamic Web Module 3.0 requires Java 1.6 or newer, java plugin error
- Why does is happen in eclipse that a JNI error has occured?
- java.lang.ClassNotFoundException: com.mysql.jdbc.Driver on eclipse
- Child Activity Not receiving data?
- BufferOverflowException when building application
- Change focus to the editor in Eclipse while searching
- ActionBar is appearing in the first activity but not appearing the second one
- Open a project in Eclipse
- Unable to Find Specific Libraries in Eclipse Project
- Fuzz testing in Eclipse? Rule based fuzzer in 'Run As..."
- FindBugs shows only the first occurrence of a bug
- Eclipse auto refresh resources
- Display changelog after eclipse plugin update
- Committing failed from Egit eclipse
- How to hide folder "Search Paths" in a Texlipse project
- How do I set the build path for E-P-I-C in Eclipse Galileo?
- Type IQuery does not take parameters Error in org.eclipse.equinox.p2.query and org.eclipse.equinox.p2.metadata
- From eclipse to phonegap - signing android phonegap app
- What is the method to use different programming languages in Eclipse?
- C++ Debugging: trouble in both eclipse and command line
- Custom exception class not being compiled into .class file
- RegEx: How to find instance of new class in Eclipse?
- Unable to update Eclipse / STS 3.7.3