Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ cucumber-java-framework
└── admin.feature
```

## Test cases

Every scenario carries its test case ID in its name and as a tag (`[TC-101] Successful login with valid credentials`, `@TC-101`). The seven cases (login TC-101 to TC-104, admin TC-105 to TC-107) are written out for a manual run in [docs/manual-test-cases.md](docs/manual-test-cases.md); run one with `mvn test -Dcucumber.filter.tags="@TC-106"`.

## How it works

The framework has three layers:
Expand Down
86 changes: 86 additions & 0 deletions docs/manual-test-cases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Manual test cases

The scenarios this framework automates, written as a tester would run them by hand. Every case has an
ID; the Cucumber scenario that covers it carries the same ID in its name (`[TC-101] Successful login
with valid credentials`) and as a tag (`@TC-101`), so a failure in the report leads straight to the
case below, and one case can be run on its own:

```
mvn test -Dcucumber.filter.tags="@TC-106"
```

## Setup

- Application: OrangeHRM demo <https://opensource-demo.orangehrmlive.com> (public, shared with other
testers).
- Admin login: `Admin` / `admin123` (`src/test/resources/config.properties`).

## Summary

| ID | Title | Type | Priority | Feature file |
|---|---|---|---|---|
| TC-101 | Successful login with valid credentials | Smoke | High | `login.feature` |
| TC-102 | Login is rejected (wrong password, unknown user) | Negative | High | `login.feature` (Scenario Outline) |
| TC-103 | Login is not submitted without a password | Negative | Medium | `login.feature` |
| TC-104 | Successful logout | Smoke | High | `login.feature` |
| TC-105 | Open the System Users page from the menu | Smoke | High | `admin.feature` |
| TC-106 | Search users by username and status | Regression | High | `admin.feature` |
| TC-107 | Reset clears the search filters | Regression | Medium | `admin.feature` |

---

## Login (`features/login.feature`)

Precondition for all: the login page is open.

### TC-101 Successful login with valid credentials

| # | Step | Expected result |
|---|---|---|
| 1 | Enter `Admin` / `admin123`, click **Login** | The Dashboard is displayed |

### TC-102 Login is rejected

For every data set: enter the username and password, click **Login**. Expected: the message
"Invalid credentials"; still on the login page.

| Data set | Username | Password |
|---|---|---|
| the password is wrong | `Admin` | `wrong123` |
| the user is unknown | `nobody42` | `admin123` |

### TC-103 Login is not submitted without a password

| # | Step | Expected result |
|---|---|---|
| 1 | Enter username `Admin`, leave the password empty, click **Login** | The **Password** field shows "Required"; no login request |

### TC-104 Successful logout

| # | Step | Expected result |
|---|---|---|
| 1 | Log in as in TC-101 | Dashboard |
| 2 | Open the user menu (top right), click **Logout** | The login page is displayed |

## Admin user management (`features/admin.feature`)

Precondition for all: logged in as `Admin`.

### TC-105 Open the System Users page from the menu

| # | Step | Expected result |
|---|---|---|
| 1 | Click **Admin** in the side menu | System Users page: page title "Admin", the user search form and the user list |

### TC-106 Search users by username and status

| # | Step | Expected result |
|---|---|---|
| 1 | On System Users enter username `Admin`, choose status **Enabled**, click **Search** | Only users named "Admin" with status "Enabled" are listed |

### TC-107 Reset clears the search filters

| # | Step | Expected result |
|---|---|---|
| 1 | Enter username `Admin`, choose status **Enabled** | Filters filled |
| 2 | Click **Reset** | The username field is empty and status shows "-- Select --" |
10 changes: 6 additions & 4 deletions src/test/resources/features/admin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ Feature: Admin user management
Background:
Given the admin is logged in

@smoke
Scenario: Open the System Users page from the menu
@smoke @TC-105
Scenario: [TC-105] Open the System Users page from the menu
When the admin opens the "Admin" menu
Then the System Users page is displayed

Scenario: Search users by username and status
@TC-106
Scenario: [TC-106] Search users by username and status
Given the admin is on the System Users page
When the admin filters by username "Admin"
And the admin filters by status "Enabled"
And the admin runs the search
Then only users named "Admin" with status "Enabled" are listed

Scenario: Reset clears the search filters
@TC-107
Scenario: [TC-107] Reset clears the search filters
Given the admin is on the System Users page
When the admin filters by username "Admin"
And the admin filters by status "Enabled"
Expand Down
14 changes: 8 additions & 6 deletions src/test/resources/features/login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ Feature: Login
Background:
Given the user is on the login page

@smoke
Scenario: Successful login with valid credentials
@smoke @TC-101
Scenario: [TC-101] Successful login with valid credentials
When the user logs in with valid credentials
Then the dashboard is displayed

# One scenario per Examples row; <reason> is replaced in the scenario name
Scenario Outline: Login is rejected when <reason>
@TC-102
Scenario Outline: [TC-102] Login is rejected when <reason>
When the user logs in with username "<username>" and password "<password>"
Then the error message "Invalid credentials" is shown

Expand All @@ -26,12 +27,13 @@ Feature: Login
| the password is wrong | Admin | wrong123 |
| the user is unknown | nobody42 | admin123 |

Scenario: Login is not submitted without a password
@TC-103
Scenario: [TC-103] Login is not submitted without a password
When the user logs in with username "Admin" and no password
Then the "Password" field shows "Required"

@smoke
Scenario: Successful logout
@smoke @TC-104
Scenario: [TC-104] Successful logout
Given the user has logged in with valid credentials
When the user logs out
Then the login page is displayed
Loading