Test Automation using Cucumber, Selenium, REST-Assured, JUnit and Maven, with Java Language


How to Create?

1. Java Development Kit (JDK)

  • Download and install JDK
  • Setting the system variables
    • Create and open your .bash_profile using Terminal
      $ cd ~/
      $ touch .bash_profile
      $ open -e .bash_profile
    • Set the Java paths in your .bash_profile file
      export JAVA_HOME=/Library/Java/JavaVirtualMachines/{JDK_VERSION_FOLDER}/Contents/Home
      export PATH=$PATH:$JAVA_HOME/bin
      
    • Save and exit your .bash_profile
  • Type java -version in your Terminal to verify installation and find out your java version
  • See the output of java version

2. Homebrew

  • Install Homebrew using Terminal and enter the following command
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Follow the instructions until Homebrew installing success
  • Type brew --version to find out your Homebrew version
  • See the output of homebrew version

3. ChromeDriver

  • Install ChromeDriver using brew
  • Type brew cask install chromedriver in your Terminal
  • Follow the instructions until chromedriver installing success
  • Type chromedriver -version to find out your chromedriver version
  • See the output of chromedriver version

4. Maven

  • Download Maven as your build tools
  • Extract downloaded maven into your current or random directory
  • Adding maven to the environment path
  • Add path variable to .bash_profile file
    export HOME=/{YOUR_DIRECTORY}/apache-maven-{YOURVERSION}
    export PATH=$PATH:$HOME/bin
    
  • Verify your maven installation using mvn -version in your Terminal
  • See the output of Maven version

5. Intellij IDEA

  • Download and install your IDE using Intellij IDEA or etc.
  • Open your IDE that installed
  • Create new project using Maven Project
    • Select File, New, Project...
    • New Project window opened
    • Select Maven, Select Project SDK using dropdown list, Next
    • Fill the field in Group Id, Artifact Id, Version, then Next
    • Edit some field if needed, Finish
    • Default Maven Project should be like this

How to Execute?

1. Run the Test

  • Run a specific test

    • Use any tags in some test cases
    • Then use mvn install -Dcucumber.options="--tags @SomeTags" from Terminal for running the tests
  • Clean files generated in the result folder

    • Add clean in a script for running the tests, like mvn clean install etc

2. Test Result

  • See the result inside target/cucumber-reports/advanced-reports/cucumber-html-reports folders that automatically generated after finished the test execution
  • Open html file in your browser
  • Or you can create your result view using json file inside target/cucumber-reports
  • Some sample of test results image1 image2 image3 image4 image5 image6 image7