Skip to content

This is a simple project that would allow anyone to get up and running with Java, Maven, Selenium and TestNG

License

Notifications You must be signed in to change notification settings

QualityWorksCG/java-maven-testng-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QualityWorks

Java Maven TestNG Automation Starter

This is a simple project that would allow anyone to get up and running with Java, Maven, Selenium and TestNG. It also explains how to execute a simple test that will assert the title of a page.

Currently the project has one test that will navigate to http://www.qualityworkscg.com/ and verify the title matches QualityWorks Consulting Group

Table of Contents

There are a few things we need before running the tests. These are:

  1. Java Installation / Update

  2. Setting up Eclipse

  3. Running the Project

  4. Special Notes

Java Installation / Update

Check your system to see if you have the latest Java version installed.

Command:

$ java -version

If you do not have the latest Java installed, find out how to install Java here.

Ensure your JAVA_HOME environment to the location of the installed JDK. Find out how to do that here.

Setting up Eclipse

Navigate to the Eclipse download page and download eclipse for Java EE developers.

Installing TestNG

  1. Installing a Plugin:

    • Inside Eclipse, click on the Help menu
    • Select Install New Software.

    Install New Software-1

  2. Locating the Plugin:

    Install New Software-2

  3. Selecting the Plugin:

    • Ensure the TestNG checkbox is selected

    • Click the "Next" button to the right bottom

      Install New Software

  4. Finishing up:

    • Accept the terms of the license agreement
    • Click on the Finish button

    Install New Software

Setting up Maven

  1. Download Maven here.

    Maven Installation

  2. Unzip the distribution archive to the directory you wish to install Maven. I extracted maven to my Documents folder

  3. Add Maven to the PATH. More information can be found in the README.txt in the zip folder.

    • Here's an example of how I added Maven to my PATH on MacOS. I added the folowing to the ~/.bash_profile.
    $ export PATH=/Users/admin/Documents/Software/apache-maven-3.5.0/bin:$PATH
    
    • Then sourced (execute) the content of the ~/.bash_profile
    $ source ~/.bash_profile
  4. Verify Maven was correctly installed

    • Command:
    $ mvn –version

    Maven dependencies are crucial to running any Maven project.

    Maven dependencies contains key references to libraries that a Maven project needs to execute. The pom.xml in the root of a Maven project file stores the dependencies (similar to the package.json for Node and gemfile for Ruby) for a project.

Running the Project

From Eclipse

  1. Import this project into Eclispe
  2. Right click the project then select Run As then Maven Tests
  • Running Tests

    Following the above steps executes the configurations found in the testing.xml file by default.

From the Command Line

Navigate to the location of project then execute mvn test.

Expected output:

Expected Test Output

Special Notes

  • Ensure FF version 48 or higher is installed

Contributing

Feel free to submit a pull requests! For specifics on how to contribute to this project, check out the contributing file.

License

This project is released under the MIT License.

About

This is a simple project that would allow anyone to get up and running with Java, Maven, Selenium and TestNG

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages