Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Software Testing Course Project: Add tests to discover bugs #11

Draft
wants to merge 77 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
ae33aee
add file
K02D Apr 12, 2024
cb7d73d
add text
K02D Apr 12, 2024
4addbb3
first pass
K02D Apr 12, 2024
f184c3a
revert tests
K02D Apr 12, 2024
0e00ee4
add to gitignore
K02D Apr 12, 2024
e7e0ef1
add coverage run
K02D Apr 12, 2024
2fe1dc5
aint working
shihd1 Apr 21, 2024
811ba8a
fix tests
K02D Apr 21, 2024
968b45e
Add tests for testing models
shihd1 Apr 21, 2024
1f01668
Merge pull request #1 from K02D/tests-kiron
K02D Apr 21, 2024
c01d41d
update readme
K02D Apr 21, 2024
8155054
fix setup function
K02D Apr 21, 2024
8c42615
add some passing tests
K02D Apr 22, 2024
5178d0e
Add test GUI login functionality
shihd1 Apr 22, 2024
8011a94
Merge pull request #3 from K02D/tests-kiron
K02D Apr 22, 2024
41873b4
Merge pull request #2 from K02D/tests-darren
K02D Apr 22, 2024
a11b9f1
fix add staff test
K02D Apr 23, 2024
1933a9c
Add test-staff-apply-leave
shihd1 Apr 23, 2024
8515f3b
Add test for updating profile
shihd1 Apr 23, 2024
6f04156
test staff add and edit student's results
shihd1 Apr 23, 2024
3df37d9
add test staff view notifications
shihd1 Apr 23, 2024
ae60cac
add working tests
K02D Apr 24, 2024
e5cb682
use gif
K02D Apr 24, 2024
66acea8
add test staff take update attendance
shihd1 Apr 24, 2024
f6532d5
cleanup test_staff_GUI
shihd1 Apr 24, 2024
d7c76a6
add more tests
K02D Apr 24, 2024
3989926
get coverage to 92
K02D Apr 24, 2024
51bbda1
cleanup test staff GUI
shihd1 Apr 24, 2024
49e20aa
test student GUI
shihd1 Apr 24, 2024
49d6898
get to 97
K02D Apr 24, 2024
f3597f7
Merge pull request #4 from K02D/tests-darren
K02D Apr 24, 2024
8c5615c
83 coverage
K02D Apr 24, 2024
ed74c4f
increase coverage to 91
K02D Apr 24, 2024
8e89aef
add nonfunctional tests for exceptions
K02D Apr 24, 2024
845ebac
clean up test student GUI
shihd1 Apr 24, 2024
40a2940
cover email backend
K02D Apr 24, 2024
4199465
create GUI tests for admin (login; update profile; add/manage course,…
shihd1 Apr 24, 2024
bf33530
Add admin test for add/manage staff and students
shihd1 Apr 24, 2024
ba6861f
get more coverage
K02D Apr 24, 2024
50be74d
Add admin test send notification to staff and student
shihd1 Apr 24, 2024
d180970
add admin test view attendance, student/staff feedback, student/staff…
shihd1 Apr 24, 2024
ef7f131
clean test admin GUI
shihd1 Apr 24, 2024
672aba4
add branch flag
K02D Apr 24, 2024
18a74cd
remove stray print statements
K02D Apr 24, 2024
196cb03
Create test_staff_views
sam-chordia Apr 24, 2024
a0b28b9
Merge pull request #5 from K02D/tests-darren
K02D Apr 24, 2024
8378a5f
fix staff views
K02D Apr 24, 2024
6a1ecc2
add command to run all tests
K02D Apr 24, 2024
9678005
removed faults
sam-chordia Apr 24, 2024
1d35551
get to 94% for views
K02D Apr 24, 2024
29d4c09
get to 91
K02D Apr 25, 2024
da1ccc9
get to 100
K02D Apr 26, 2024
85c19cd
get to 99 for student_views
K02D Apr 26, 2024
138afeb
get student views to 100
K02D Apr 26, 2024
f883169
get views to 100
K02D Apr 26, 2024
ac55fc1
add duplicate email check
K02D Apr 26, 2024
8addb9f
Create file for setting up data for GUI testing
shihd1 Apr 26, 2024
9c68fb4
fix some tests
shihd1 Apr 26, 2024
8d2f249
Merge pull request #6 from K02D/tests-darren
shihd1 Apr 26, 2024
10ee7d0
Update README.md
shihd1 Apr 26, 2024
5c01729
fix test
shihd1 Apr 26, 2024
f3c1127
get middleware to 95
K02D Apr 26, 2024
64bc046
Add error descriptions that occur
shihd1 Apr 26, 2024
20a581c
Merge branch 'tests' of https://github.com/K02D/College-ERP into tests
shihd1 Apr 26, 2024
931e247
get middleware to 100
K02D Apr 26, 2024
b627fc9
add comment
K02D Apr 26, 2024
42c7531
fixed test errors to be caught and increased code coverage
sam-chordia Apr 26, 2024
dd51637
mark tests which detect faults
K02D Apr 26, 2024
844eda4
make tests more focused
K02D Apr 26, 2024
c0d8808
add more fault annotations
K02D Apr 26, 2024
003bdc3
update instructions
K02D Apr 26, 2024
5499862
revert
K02D Apr 26, 2024
0bb4ce0
revert
K02D Apr 26, 2024
5194902
comment out captcha
K02D Apr 26, 2024
23a151f
update readme
K02D Apr 26, 2024
eb85e49
added chromedriver installation command
sam-chordia Apr 26, 2024
c837b7a
reorder instructions
K02D Apr 26, 2024
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
Binary file added .DS_Store
Binary file not shown.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Ignore all Markdown files

*.pyc
README.md

.coverage
*.gif
venv
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
124 changes: 103 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# College Enterprise Resource Planner

This is a College Enterprise Resource Planner Developed by me and my project partners for my college.
We use Python/Django Framwork for building an fully functional web application. (If facing problem!! : put discussion)
## Deployed at <a href="https://syncx.pythonanywhere.com" target="_blank" rel="SIGCE"><img src="media/SIGCE.png" width="20" height="20" alt="SIGCE" /><span> SIGCE</span></a> v1.1.0

For viewing the home page of student you must have required credentials given below

-> E-Mail : student@student.com
-> Password : student@erp
## Deployed at <a href="https://syncx.pythonanywhere.com" target="_blank" rel="SIGCE"><img src="media/SIGCE.png" width="20" height="20" alt="SIGCE" /><span> SIGCE</span></a> v1.1.0

For viewing the home page of student you must have required credentials given below

-> E-Mail : student@student.com
-> Password : student@erp

## Features of this Project


### A. Admin Users Can

1. See Overall Summary Charts of Students Performances, Staff Performances, Courses, Subjects, Leave, etc.
2. Manage Staff (Add, Update and Delete)
3. Manage Students (Add, Update and Delete)
Expand All @@ -25,119 +25,138 @@ For viewing the home page of student you must have required credentials given be
9. Review (Approve/Reject) Student/Staff Leave

### B. Staff/Teachers Can

1. See the Overall Summary Charts related to their students, their subjects, leave status, etc.
2. Take/Update Students Attendance
3. Add/Update Result
4. Apply for Leave
5. Send Feedback to HOD

### C. Students Can

1. See the Overall Summary Charts related to their attendance, their subjects, leave status, etc.
2. View Attendance
3. View Result
4. Apply for Leave
5. Send Feedback to HOD


## Support Developer
1. Add a Star 🌟 to this 👆 Repository
2. Follow on Github & LinkedIn

1. Add a Star 🌟 to this 👆 Repository
2. Follow on Github & LinkedIn

## How to Install and Run this project?

### Pre-Requisites:

1. Install Git Version Control
[ https://git-scm.com/ ]
[ https://git-scm.com/ ]

2. Install Python Latest Version
[ https://www.python.org/downloads/ ]
[ https://www.python.org/downloads/ ]

3. Install Pip (Package Manager)
[ https://pip.pypa.io/en/stable/installing/ ]
[ https://pip.pypa.io/en/stable/installing/ ]

*Alternative to Pip is Homebrew*
_Alternative to Pip is Homebrew_

### Installation

**1. Create a Folder where you want to save the project**

**2. Create a Virtual Environment and Activate**

Install Virtual Environment First

```
$ pip install virtualenv
```

Create Virtual Environment

For Windows

```
$ python -m venv venv
```

For Mac

```
$ python3 -m venv venv
```

For Linux

```
$ virtualenv .
```

Activate Virtual Environment

For Windows

```
$ source venv/scripts/activate
```

For Mac

```
$ source venv/bin/activate
```

For Linux

```
$ source bin/activate
```

**3. Clone this project**

```
$ git clone https://github.com/Ansarimajid/College-ERP.git
```

Then, Enter the project

```
$ cd College-ERP
```

**4. Install Requirements from 'requirements.txt'**

```python
$ pip3 install -r requirements.txt
```

**5. Add the hosts**

- Got to settings.py file
- Then, On allowed hosts, Use **[]** as your host.
- Got to settings.py file
- Then, On allowed hosts, Use **[]** as your host.

```python
ALLOWED_HOSTS = []
```
*Do not use the fault allowed settings in this repo. It has security risk!*

_Do not use the fault allowed settings in this repo. It has security risk!_

**6. Now Run Server**

Command for PC:

```python
$ python manage.py runserver
```

Command for Mac:

```python
$ python3 manage.py runserver
```

Command for Linux:

```python
$ python3 manage.py runserver
```
Expand All @@ -146,33 +165,36 @@ $ python3 manage.py runserver

Create Super User (HOD)
Command for PC:

```
$ python manage.py createsuperuser
```

Command for Mac:

```
$ python3 manage.py createsuperuser
```

Command for Linux:

```
$ python3 manage.py createsuperuser
```



## Project's Journey

| Admin/Staff/Student Login |
| Add and Edit Course |

- [x] Add and Edit Staff
- [x] Add and Edit Student
- [x] Add and Edit Subject
- [x] Upload Staff's Picture
- [x] Upload Student's Picture
- [x] Sidebar Active Status
- [x] Named URLs
- [x] Model Forms for adding student
- [x] Model Forms for adding student
- [x] Model Forms for all
- [x] Views Permission (MiddleWareMixin)
- [x] Attendance and Update Attendance
Expand All @@ -183,12 +205,12 @@ $ python3 manage.py createsuperuser
- [x] Reply to Leave Applications
- [x] Reply to Feedback
- [x] Admin View Attendance
- [x] Password Change for Admin, Staff and Students using *set_password()*
- [x] Password Change for Admin, Staff and Students using _set_password()_
- [x] Admin Profile Edit
- [x] Staff Profile Edit
- [x] Student Profile Edit
- [x] Student Dashboard Fixed
- [x] Passing Page Title From View - Improved
- [x] Passing Page Title From View - Improved
- [x] Staff Dashboard Fixed
- [x] Admin Dashboard Fixed
- [x] Staff Add Student's Result
Expand All @@ -197,3 +219,63 @@ $ python3 manage.py createsuperuser
- [x] Student View Result
- [x] Change all links to be dynamic
- [x] Code Restructure - Very Important

### Run tests

Set up virtual environmment and install requirements
```
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
```

Create a superuser with the following specifications
```
python3 manage.py createsuperuser
$ Email: superuser@gmail.com
$ Password: superuser
$ Password (again): superuser
$ Bypass password validation and create user anyway? [y/N]: y
```

Run server
```
python3 manage.py runserver
```

Run tests in another terminal:
Set up for GUI testing
```
source venv/bin/activate
brew install chromedriver
brew upgrade chromedriver
xattr -d com.apple.quarantine $(which chromedriver)
python3 tests/GUI_setup.py
```
Notes
- If the second command prints "No such xattr: com.apple.quarantine", ignore it and move on to the next command
- Make sure to have [homebrew](https://docs.brew.sh/Installation) installed

# statement coverage

```
coverage run manage.py test -v=2 tests
```

# branch coverage

```
coverage run --branch manage.py test -v=2 tests
```

# Check coverage

`coverage report`: see coverage in terminal
`coverage html`: see coverage in browser

Some non-logic files are excluded. See what those are in setup.cfg

# Errors

If you get the error "error: externally-managed-environment" when running pip3 install-" when trying to run the server, try the following:
`export PATH=".:/Library/Frameworks/Python.framework/Versions/3.12/bin:/usr/local/bin:${PATH}"`
Loading