Skip to content

mfarisgh/katalon_web_faris

Repository files navigation


Katalon (Web Testing) + 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 Groovy/Java project for Automation Testing using Katalon 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 fork it and customize it further 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 Login (Positive & negative scenarios)
  • OrangeHRM Password Reset (Positive & negative scenarios)
  • OrangeHRM Username Search (Positive & negative scenarios)
  • OrangeHRM Add New User Account (Positive & negative scenarios)
  • OrangeHRM Delete User Account (Positive & negative scenarios)
  • OrangeHRM Add New Job Title (Positive & negative scenarios)
  • OrangeHRM Delete Job Title (Positive & negative scenarios)
  • OrangeHRM Add Pay Grade (Positive & negative scenarios)
  • OrangeHRM Add Currency (Positive & negative scenarios)
  • OrangeHRM Delete Currency (Positive & negative scenarios)
  • OrangeHRM Edit Currency (Positive & negative scenarios)
  • OrangeHRM Add Employment Status (Positive & negative scenarios)
  • OrangeHRM Delete Employment Status (Positive & negative scenarios)
  • OrangeHRM Add Job Category (Positive & negative scenarios)
  • OrangeHRM Delete Job Category (Positive & negative scenarios)
  • OrangeHRM Add New Skill (Positive & negative scenarios)
  • OrangeHRM Delete Skill (Positive & negative scenarios)
  • OrangeHRM Edit Skill (Positive & negative scenarios)

(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. Installed Katalon Studio.

Optional

  1. A Jira Cloud account.
  2. 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).
  3. Jenkins or CircleCI, if you intend to use the project with CI (I've only tested these two, 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 Katalon Studio.

  3. [Optional] If you want to utilize the Jira integration, look for local.properties in Include/config. Configure it as follows:

    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. Update WebDrivers: Tools -> Update WebDrivers -> Your preferred browser.

  5. Choose and open by double-clicking any of the Test Cases or Test Suites in Test Cases or Test Suites folder.

  6. Change profile/environment to DemoLive to be able to use all the variables/parameters specified in Test Cases. It is located on the top right, named "default".

  7. Click the Play button on the top right.

  8. 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. Katalon Runtime Engine (KRE)

    wget https://download.katalon.com/9.3.2/Katalon_Studio_Engine_Linux_64-9.3.2.tar.gz
    sudo tar xvzf ./Katalon_Studio_Engine_Linux_64-9.3.2.tar.gz
    sudo mv ./Katalon_Studio_Engine_Linux_64-9.3.2 ./kre
    sudo chmod -R 777 ./kre
  3. You can refer to the sample jenkins_pipeline_katalon.txt to assign respective values such as the directory of KRE, project folder, etc. Copy the contents (in the txt file) to your Jenkins job settings -> Pipeline (Pipeline script).

  4. If your first time build is failed, consider moving/copying the KRE folder into the Jenkins workspace folder.

    sudo cp -r /home/<your OS username>/kre /var/lib/jenkins/workspace/<name of job>/kre
    sudo chmod -R 777 /var/lib/jenkins/workspace/<name of job>/kre

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

B. CircleCI (Not for the faint of heart!)

  1. CircleCI is intended to be used with projects that is already committed to your own GitHub repository. The behaviour is not the same as Jenkins. With Jenkins, you can checkout any compatible public repositories.
  2. To use CircleCI, you may fork my repository to your own GitHub repository. Proceed with any changes as desired in your own repository.
  3. Ensure that you have linked your GitHub account to your CircleCI account. You will be able to see your GitHub projects in CircleCI and follow it.
  4. Since the project has already included the .circleci/config.yml file, you should be able to configure the pipeline straight away without the need to go through the first time configuration wizard. Otherwise, click on where it says "Skip ... bla3". If there is a button where it says "Use existing config", click it. Then, click "Start building".
  5. You will be presented with an in-app configuration editor. You may remove the following line of code to be able to run the pipeline using CircleCI's provided runner, click "Save and Run". If it fails, proceed to step 9. Otherwise, if you want to set-up your own runner using your Linux server, proceed to step 6.
    resource_class: mfarisgh/faris-self-hosted
  6. If you want to self-host a runner using your Linux server without the usage of Docker images, ensure that OpenJDK, a browser and Katalon Runtime Engine (KRE) have been installed. Follow step 2 in A. Jenkins.
  7. Set-up your own runner (Part 1).
  8. Set-up your own runner (Part 2).
  9. Set environment variables in your project. Put the following environment variables and respective values.
    <Name> = <Value>
    KRE_HOME = '<your Katalon Runtime Engine folder location>'
    PROJECT_PATH = '/var/lib/circleci-runner/workdir/OrangeFaris.prj'
    TS_PATH='Test Suites/AutomationSuite'
    BROWSER_TYPE='Chrome (headless)' #it is better to use headless as we will run it on a non-GUI Linux server
    EXEC_PROFILE='DemoLive'
    KAT_API_KEY='<your Katalon API key>' #refer to this website on how to get them https://docs-dev.katalon.com/katalon-platform/administer/settings/katalon-api-keys-in-katalon-studio#gsc.tab=0
    JIRA_ENABLED='true' #true or false
    JIRA_URL='<your Jira URL with ending slash>' #You may leave it blank if false
    JIRA_USERNAME='<your Jira email address>' #You may leave it blank if false
    JIRA_TOKEN='<your Jira 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_PROJ='<your Jira project code>' #You may leave it blank if false
  10. If you use self-hosted runner. In your CircleCI project, select branch 'master' and click "Edit Config". Replace the following line of code with your resource class name for your self-hosted runner.
    resource_class: #your resource class name for your self-hosted runner
  11. Click "Save and Run" if you are from the in-app configuration editor. Otherwise, click "Trigger Pipeline" if you are in the project page.
  12. Keep in mind that every changes in your GitHub repo automatically triggers the pipeline. So, if you use CircleCI and constantly making changes to your GitHub repo. You will need to monitor your CircleCI project's pipeline to ensure there are no unwanted running jobs. Especially if you are using self-hosted runner, where if your runner is shut down and you are still making changes to your GitHub repo, you will need to manually cancel the running job in CircleCI project's pipeline.

Side note: Yeah, I know the steps are confusing/cumbersome at first. Just use Jenkins, it will be a bit easier for starters. Like Jenkins, the CircleCI self-hosted runner works on a 1GB RAM and 1 core CPU Linux virtual machine using VirtualBox but not in AWS EC2 Free Tier instances despite the almost same specs.

(back to top)

Contact

M. Faris - Facebook - mfaris.official@gmail.com

GitHub : mfarisgh

GitLab : mfarisgl

(back to top)

Acknowledgements

(back to top)