Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
3e28d2b
ci: run tests in lightmode; introduce dormant individual test runner
ruthra-kumar May 15, 2025
f75beec
refactor(test): replace all IntegrationTestCase with HRMSTestSuite
ruthra-kumar Feb 19, 2026
ae85026
refactor(test): remove all change_settings
ruthra-kumar Feb 19, 2026
45cf592
refactor(tests): refactor HRMSTestSuite
asmitahase Mar 5, 2026
43bfdc4
refactor(test): drop empty test files
ruthra-kumar Mar 5, 2026
10d6619
refactor(test): clean up setupclass
ruthra-kumar Mar 5, 2026
3163a9d
refactor(test): make employee reminders deterministic
ruthra-kumar Mar 5, 2026
29a2cd8
refactor(test): make test attendance deterministic
ruthra-kumar Mar 5, 2026
e57db2d
refactor(test): make test attendance request deterministic
ruthra-kumar Mar 5, 2026
f5b1f20
refactor(test): make compensatory leave request deterministic
ruthra-kumar Mar 5, 2026
264f55f
refactor(test): make employee attendance tool deterministic
ruthra-kumar Mar 5, 2026
59b325b
refactor(test): remove all setUpClass, tearDownClass and tearDown
ruthra-kumar Mar 5, 2026
64592d0
refactor(test): master data setup
ruthra-kumar Mar 5, 2026
6f72ada
fix: add and save holidays in the holiday list
asmitahase Mar 6, 2026
303943a
refactor(tests): test employee checkins
asmitahase Mar 6, 2026
8f0aa4c
refactor(tests): test exit interview
asmitahase Mar 6, 2026
a90918b
fix: create designations
asmitahase Mar 6, 2026
65300bc
refactor(tests): test employee onboarding
asmitahase Mar 6, 2026
b292658
refactor(tests): test employee promotion
asmitahase Mar 6, 2026
51e8486
refactor(tests): test employee transfer
asmitahase Mar 6, 2026
f95047c
refactor(tests): test employee onboarding
asmitahase Mar 6, 2026
8e8e72e
fix: keep default float precision as 2
asmitahase Mar 6, 2026
7cad870
refactor(tests): test holiday list assignment
asmitahase Mar 6, 2026
2f39574
refactor(tests): test job applicant
asmitahase Mar 6, 2026
45fab0b
refactor(tests): test job offer
asmitahase Mar 6, 2026
9be91bb
fix: add required designation
asmitahase Mar 6, 2026
b091bb7
refactor(tests): test leave adjustment
asmitahase Mar 6, 2026
242f30b
refactor(tests): test earned leave schedule
asmitahase Mar 6, 2026
8388d75
refactor(test): make salary structure deterministic
ruthra-kumar Mar 7, 2026
b977da6
refactor(tests): remove redundant test_dependencies
ruthra-kumar Mar 7, 2026
51bee29
refactor(test): make salary slip deterministic; removed setup_test()
ruthra-kumar Mar 7, 2026
ce6133a
refactor(test): pass company in salary component tests
ruthra-kumar Mar 7, 2026
863a83d
refactor(test): make additional salary deterministic
ruthra-kumar Mar 7, 2026
2f08902
refactor(test): make leave encashment deterministic
ruthra-kumar Mar 8, 2026
bd0bc5a
refactor(test): make leave policy assignment deterministic
ruthra-kumar Mar 8, 2026
11fa24b
refactor(test): make overtime slip deterministic
ruthra-kumar Mar 8, 2026
c547408
refactor(test): remove redundant code
ruthra-kumar Mar 8, 2026
39abcc7
refactor(tests): test earned leaves
asmitahase Mar 9, 2026
3f4382c
refactor(tests): test goal
asmitahase Mar 9, 2026
7573d3d
refactor(tests): test appraisal
asmitahase Mar 9, 2026
c15e6f7
refactor(tests): test attendance request
asmitahase Mar 10, 2026
58e4d88
refactor(tests): test employee performance feedback
asmitahase Mar 10, 2026
951568b
fix: create persistent records for leave block list
asmitahase Mar 10, 2026
696cf0d
refactor(tests): test leave control panel
asmitahase Mar 10, 2026
0f276ea
refactor(tests): test training event
asmitahase Mar 10, 2026
a333e53
refactor(tests): test training feedback
asmitahase Mar 10, 2026
fa8f84d
refactor(tests): test overtime slip
asmitahase Mar 10, 2026
3419110
refactor(tests): test upload attendance
asmitahase Mar 10, 2026
52b236d
refactor(tests): test employee analytics
asmitahase Mar 10, 2026
5319bec
refactor(tests): test employee exits
asmitahase Mar 10, 2026
80ddf6f
refactor(tests): test leave application
asmitahase Mar 13, 2026
c2b39d3
refactor(tests): test leave policy assignment
asmitahase Mar 13, 2026
aeff2d6
refactor(tests): test shift assignment
asmitahase Mar 13, 2026
2c6764f
refactor(tests): test appraisal overview
asmitahase Mar 13, 2026
ae8dbb3
refactor(tests): test arrears
asmitahase Mar 13, 2026
72b45fd
refactor(tests): test payroll correction
asmitahase Mar 13, 2026
9ea7342
refactor(tests): test salary component
asmitahase Mar 13, 2026
b321ca5
refactor(tests): payroll entry
asmitahase Mar 13, 2026
51260f4
fix: don't submit non-submittable doctype
asmitahase Mar 16, 2026
7e62f6a
refactor(tests): test salary withholding
asmitahase Mar 16, 2026
bc593fe
refactor(tests): payroll entry
asmitahase Mar 16, 2026
b4839cf
refactor(tests): test expense claim
asmitahase Mar 16, 2026
d714598
refactor(tests): test salary slip
asmitahase Mar 16, 2026
23270f1
refactor(tests): test salary slip
asmitahase Mar 17, 2026
ed8846f
fix: set country for regional method overrides
asmitahase Mar 17, 2026
a653db5
fix: set correct company value
asmitahase Mar 17, 2026
1bde09b
fix: set company list, lost it while resolving merge conflicts
asmitahase Mar 17, 2026
9beb56b
fix: explicit None type check
asmitahase Mar 17, 2026
c297f8a
refactor(test): code cleanup
ruthra-kumar Mar 18, 2026
cf81309
fix: precision in project profitability
asmitahase Mar 19, 2026
01500e4
fix: hardcode default value for company/currency
asmitahase Mar 19, 2026
8a428e1
chore: cleaning up db.delete and commented code
asmitahase Mar 19, 2026
f9902e3
chore: make the linter happy
asmitahase Mar 19, 2026
f562dfa
fix: test employee reminders setup
asmitahase Mar 19, 2026
4ac41d1
Merge pull request #4244 from ruthra-kumar/test_suite_refactor_v16
asmitahase Mar 19, 2026
c9ea710
fix: use background job to bulk mark attendance for more than 10 records
asmitahase Mar 18, 2026
25785c1
fix: commit after batch (had lost the indent because of the flag)
asmitahase Mar 18, 2026
a28074a
fix(expense_claim): filter reimbursed payment entry
iamkhanraheel Mar 18, 2026
05137a9
fix: modify voucher type based on account type
elshafei-developer Jan 28, 2026
c3ed959
refactor: change voucher type logic for journal entry creation
elshafei-developer Mar 15, 2026
c1d0585
Merge pull request #4246 from frappe/mergify/bp/version-16-hotfix/pr-…
asmitahase Mar 20, 2026
9a84722
fix: flaky test
asmitahase Mar 23, 2026
9c45f8a
Merge pull request #4258 from asmitahase/flaky-test
asmitahase Mar 23, 2026
d36dec8
chore: add docs to project URLs
barredterra Mar 15, 2026
bf9126e
Merge pull request #4255 from frappe/mergify/bp/version-16-hotfix/pr-…
asmitahase Mar 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
FRAPPE_BRANCH: ${{ github.event.inputs.branch }}

- name: Run Tests
run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app hrms --total-builds ${{ strategy.job-total }} --build-number ${{ matrix.container }}
run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app hrms --total-builds ${{ strategy.job-total }} --build-number ${{ matrix.container }} --lightmode
env:
TYPE: server
CAPTURE_COVERAGE: ${{ github.event_name != 'pull_request' }}
Expand Down
144 changes: 144 additions & 0 deletions .github/workflows/run-individual-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Individual

on:
workflow_dispatch:

concurrency:
group: server-individual-tests-lightmode-develop
cancel-in-progress: true

permissions:
contents: read

jobs:
discover:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Clone
uses: actions/checkout@v6
- id: set-matrix
run: |
# Use grep and find to get the list of test files
matrix=$(find . -path '*/test_*.py' | xargs grep -l 'def test_' | sort | awk '{
# Remove ./ prefix, file extension, and replace / with .
gsub(/^\.\//, "", $0)
gsub(/\.py$/, "", $0)
gsub(/\//, ".", $0)
# Add to array
tests[NR] = $0
}
END {
# Start JSON array
printf "{\n \"include\": [\n"
# Loop through array and create JSON objects
for (i=1; i<=NR; i++) {
printf " {\"test\": \"%s\"}", tests[i]
if (i < NR) printf ","
printf "\n"
}
# Close JSON array
printf " ]\n}"
}')

# Output the matrix
echo "matrix=$(echo "$matrix" | jq -c)" >> $GITHUB_OUTPUT

# For debugging (optional)
echo "Generated matrix:"
echo "$matrix"
test:
needs: discover
runs-on: ubuntu-latest
timeout-minutes: 60
env:
NODE_ENV: "production"

strategy:
fail-fast: false
matrix: ${{fromJson(needs.discover.outputs.matrix)}}
# max-parallel: 10

name: Test

services:
mysql:
image: mariadb:10.6
env:
MARIADB_ROOT_PASSWORD: 'root'
ports:
- 3306:3306
options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3

steps:
- name: Clone
uses: actions/checkout@v6

- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.14'

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 24
check-latest: true

- name: Add to Hosts
run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-

- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install
run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
env:
DB: mariadb
TYPE: server
FRAPPE_USER: ${{ github.event.inputs.user }}
FRAPPE_BRANCH: ${{ github.event.inputs.branch }}

- name: Run Tests
run: |
site_name=$(echo "${{matrix.test}}" | sed -e 's/.*\.\(test_.*$\)/\1/')
echo "$site_name"
mkdir ~/frappe-bench/sites/$site_name
cp -r "${GITHUB_WORKSPACE}/.github/helper/site_config.json" ~/frappe-bench/sites/$site_name/site_config.json
cd ~/frappe-bench/
bench --site $site_name reinstall --yes
bench --site $site_name install-app hrms
bench --site $site_name set-config allow_tests true
bench --site $site_name run-tests --module ${{ matrix.test }} --lightmode

29 changes: 13 additions & 16 deletions hrms/controllers/tests/test_employee_reminders.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from datetime import timedelta

import frappe
from frappe.tests import IntegrationTestCase
from frappe.utils import add_months, getdate

from erpnext.setup.doctype.employee.test_employee import make_employee
Expand All @@ -15,16 +14,15 @@
)
from hrms.hr.doctype.hr_settings.hr_settings import set_proceed_with_frequency_change
from hrms.hr.utils import get_holidays_for_employee
from hrms.tests.utils import HRMSTestSuite


class TestEmployeeReminders(IntegrationTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
class TestEmployeeReminders(HRMSTestSuite):
def setUp(self):
from erpnext.setup.doctype.holiday_list.test_holiday_list import make_holiday_list

# Create a test holiday list
test_holiday_dates = cls.get_test_holiday_dates()
test_holiday_dates = self.get_test_holiday_dates()
test_holiday_list1 = make_holiday_list(
"TestHolidayRemindersList",
holiday_dates=[
Expand All @@ -45,12 +43,12 @@ def setUpClass(cls):
create_holiday_list_assignment("Employee", test_employee.name, test_holiday_list1.name)

# Attach to class
cls.test_employee = test_employee
cls.test_holiday_dates = test_holiday_dates
self.test_employee = test_employee
self.test_holiday_dates = test_holiday_dates

# Employee without holidays in this month/week
test_employee_2 = make_employee("test@empwithoutholiday.io", company="_Test Company")
test_employee_2 = frappe.get_doc("Employee", test_employee_2)
test_employee_2 = frappe.get_doc("Employee", test_employee_2, company="_Test Company")

test_holiday_list2 = make_holiday_list(
"TestHolidayRemindersList2",
Expand All @@ -61,8 +59,12 @@ def setUpClass(cls):
to_date=add_months(getdate(), 2),
)
create_holiday_list_assignment("Employee", test_employee_2.name, test_holiday_list2.name)
cls.test_employee_2 = test_employee_2
cls.holiday_list_2 = test_holiday_list2
self.test_employee_2 = test_employee_2
self.holiday_list_2 = test_holiday_list2

# Clear Email Queue
frappe.db.sql("delete from `tabEmail Queue`")
frappe.db.sql("delete from `tabEmail Queue Recipient`")

@classmethod
def get_test_holiday_dates(cls):
Expand All @@ -76,11 +78,6 @@ def get_test_holiday_dates(cls):
today_date + timedelta(weeks=3),
]

def setUp(self):
# Clear Email Queue
frappe.db.sql("delete from `tabEmail Queue`")
frappe.db.sql("delete from `tabEmail Queue Recipient`")

def test_is_holiday(self):
from erpnext.setup.doctype.employee.employee import is_holiday

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# See license.txt

# import frappe
from frappe.tests import IntegrationTestCase
from hrms.tests.utils import HRMSTestSuite


class TestAppointmentLetter(IntegrationTestCase):
class TestAppointmentLetter(HRMSTestSuite):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# See license.txt

# import frappe
from frappe.tests import IntegrationTestCase
from hrms.tests.utils import HRMSTestSuite


class TestAppointmentLetterTemplate(IntegrationTestCase):
class TestAppointmentLetterTemplate(HRMSTestSuite):
pass
15 changes: 7 additions & 8 deletions hrms/hr/doctype/appraisal/test_appraisal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# See license.txt

import frappe
from frappe.tests import IntegrationTestCase

from erpnext.setup.doctype.designation.test_designation import create_designation
from erpnext.setup.doctype.employee.test_employee import make_employee
Expand All @@ -15,9 +14,10 @@
)
from hrms.hr.doctype.goal.test_goal import create_goal
from hrms.tests.test_utils import create_company
from hrms.tests.utils import HRMSTestSuite


class TestAppraisal(IntegrationTestCase):
class TestAppraisal(HRMSTestSuite):
def setUp(self):
frappe.db.delete("Goal")
frappe.db.delete("Appraisal")
Expand All @@ -29,7 +29,6 @@ def setUp(self):
engineer = create_designation(designation_name="Engineer")
engineer.appraisal_template = self.template.name
engineer.save()

self.employee1 = make_employee(
"test_appraisal1@example.com", company=self.company, designation="Engineer"
)
Expand Down Expand Up @@ -73,7 +72,7 @@ def test_final_score(self):
cycle.create_appraisals()
appraisal = self.setup_appraisal(cycle)

self.assertEqual(appraisal.final_score, 3.767)
self.assertEqual(appraisal.final_score, 3.77)

def test_final_score_using_formula(self):
cycle = create_appraisal_cycle(designation="Engineer", kra_evaluation_method="Manual Rating")
Expand All @@ -88,7 +87,7 @@ def test_final_score_using_formula(self):

appraisal = self.setup_appraisal(cycle)

self.assertEqual(appraisal.final_score, 3.767)
self.assertEqual(appraisal.final_score, 3.77)

def setup_appraisal(self, cycle):
appraisal = frappe.db.exists("Appraisal", {"appraisal_cycle": cycle.name, "employee": self.employee1})
Expand All @@ -106,7 +105,7 @@ def setup_appraisal(self, cycle):
appraisal.save()

# FEEDBACK SCORE
reviewer = make_employee("reviewer1@example.com", designation="Engineer")
reviewer = make_employee("reviewer1@example.com", designation="Engineer", company=self.company)
feedback = create_performance_feedback(
self.employee1,
reviewer,
Expand Down Expand Up @@ -160,8 +159,8 @@ def test_goal_score(self):
self.assertEqual(appraisal.appraisal_kra[1].goal_score, 35)

self.assertEqual(appraisal.goal_score_percentage, 38.75)
self.assertEqual(appraisal.total_score, 1.938)
self.assertEqual(appraisal.final_score, 0.646)
self.assertEqual(appraisal.total_score, 1.94)
self.assertEqual(appraisal.final_score, 0.65)

def test_goal_score_after_parent_goal_change(self):
"""
Expand Down
4 changes: 2 additions & 2 deletions hrms/hr/doctype/appraisal_cycle/test_appraisal_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
# See license.txt

import frappe
from frappe.tests import IntegrationTestCase

from erpnext.setup.doctype.designation.test_designation import create_designation
from erpnext.setup.doctype.employee.test_employee import make_employee

from hrms.hr.doctype.appraisal_template.test_appraisal_template import create_appraisal_template
from hrms.tests.test_utils import create_company
from hrms.tests.utils import HRMSTestSuite


class TestAppraisalCycle(IntegrationTestCase):
class TestAppraisalCycle(HRMSTestSuite):
def setUp(self):
company = create_company("_Test Appraisal").name
self.template = create_appraisal_template()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# See license.txt

import frappe
from frappe.tests import IntegrationTestCase

from hrms.tests.utils import HRMSTestSuite

class TestAppraisalTemplate(IntegrationTestCase):

class TestAppraisalTemplate(HRMSTestSuite):
def test_incorrect_weightage_allocation(self):
template = create_appraisal_template()
template.goals[1].per_weightage = 69.99
Expand Down
Loading
Loading