Skip to content

Automation Test of OrangeHRM website using Selenium

Notifications You must be signed in to change notification settings

mfarisgh/selenium_faris

Repository files navigation


Selenium + TestNG + Cucumber + LambdaTest + Jira

by M. Faris
Report Issues »

Table of Contents
  1. About The Project
  2. Getting Started
  3. Contact
  4. Acknowledgements

About The Project

This is a POC Java project for Automation Testing using Selenium to test OrangeHRM website. The goal of this project is to demonstrate how an Automation Testing is done using various combination of tools/frameworks. Of course this project is not limited to its current conditions. You may clone it to your own environment and customize it further with more tools/frameworks depending on your needs.

OrangeHRM is an open-source human resource management (HRM) software platform. It provides a comprehensive set of HR functionalities to businesses of all sizes, including features for personnel information management, attendance tracking, leave management, performance evaluation, and other HR-related tasks.

(back to top)

Built With

(back to top)

Test Scenarios

  • OrangeHRM Successful Login
  • OrangeHRM Failed Login
  • OrangeHRM Successful Username Search
  • OrangeHRM Failed Username Search

(back to top)

Getting Started

The following are the instructions on setting up your project locally. To get a local copy up and running, follow these simple steps.

Prerequisites

The following prerequisites that you will need to get started:

  1. This repo of course! You may download it as a zip file or "git clone" it to your computer.
  2. OpenJDK (I used v17 as a base).
  3. An IDE (Eclipse or IntelliJ IDEA Ultimate/Community Edition).

Optional

  1. A LambdaTest account. Get to know LambdaTest.
  2. A Jira Cloud account.
  3. A Linux server (for usage with CI). I recommend using VirtualBox for starters. You can also checkout on AWS EC2 instances for running CI on cloud server (you need credit card to register for them).
  4. Jenkins, if you intend to use the project with CI (I've only tested this, you may experiment with others at your own risk). Get to know more about CI.

(back to top)

Running the Automation Tests

  1. Ensure that you have extracted or git-cloned the project folder into your local computer.

  2. Open the project folder in your IDE.

  3. Look for local.properties in src/test/resources. Configure it as follows:

    location=  # local or lambdatest
    browser=chrome
    browser.mode=  # headful or headless
    lt.username=  # your LambdaTest username. You may leave it blank if platform used is local.
    lt.accesskey=  # your LambdaTest access key. You may leave it blank if platform used is local. Refer here on how to get them https://www.lambdatest.com/support/docs/hyperexecute-how-to-get-my-username-and-access-key/
    web.url=https://opensource-demo.orangehrmlive.com/
    jira.enabled=  # true or false
    jira.url=  # your Jira URL. Do not forget the ending slash! You may leave it blank if false.
    jira.username=  #  your Jira username (email address). You may leave it blank if false.
    jira.token=  # your Jira user token. You may leave it blank if false. Refer here on how to get them https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/
    jira.project=  # your Jira project code. e.g. STC. You may leave it blank if false.
  4. Run the tests through the testng.xml file.

  5. If you use Jira and enabled Jira in local.properties, all the failed Test Cases will be recorded as a Bug in your Jira Backlog.

(back to top)

Running the Automation Tests using CI

A. Jenkins

  1. I will be referring to the use case of Jenkins in a Linux server where the job will run as a pipeline and not involving any Docker images.

  2. If you are not using/stating any Docker images in your pipeline, your Linux server (where Jenkins was installed or where the Jenkins job will be running) must have the following installed:

    i. OpenJDK

    sudo apt install openjdk-17-jdk

    ii. Browser (I'll take Chrome as an example)

    wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    sudo apt --fix-broken install ./google-chrome-stable_current_amd64.deb
    google-chrome --version

    iii. Maven

    sudo apt install maven
  3. You can refer to the sample jenkins_pipeline_selenium.txt to assign respective values such as the platform to be used, browser, etc. Copy the contents (in the txt file) to your Jenkins job settings -> Pipeline (Pipeline script). Save and run the job.

Side note: I have tried running Jenkins in 1GB RAM and 1 core CPU Linux virtual machine using VirtualBox, it works! Although AWS EC2 Free Tier has almost the same specs (t2.micro with 1GB RAM, 1 core CPU, Linux OS), it doesn't work! No need to waste your time. It freezes on my Free Tier EC2 instances. Just get a higher paid t2 instances to be able to run Jenkins properly. Explanation 1, Explanation 2, Explanation 3

(back to top)

Contact

M. Faris - Facebook - [email protected]

GitHub : mfarisgh

GitLab : mfarisgl

(back to top)

Acknowledgements

(back to top)