Skip to content

Add UML class & sequence diagrams #55

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
Binary file added __pycache__/app.cpython-312.pyc
Binary file not shown.
41 changes: 40 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from flask import Flask
from flask import Flask, request, redirect, render_template_string

app = Flask(__name__)

@app.route("/")
Expand All @@ -10,5 +11,43 @@ def main():
def hello():
return 'I am good, how about you?'

@app.route("/login", methods=["GET", "POST"])
def login():
if request.method == "POST":
username = request.form["username"]
password = request.form["password"]
if username == "admin" and password == "admin":
return redirect("/dashboard")
return "Login failed"
return render_template_string("""
<form method="POST">
<input name="username" placeholder="Username"><br>
<input name="password" type="password" placeholder="Password"><br>
<button type="submit">Login</button>
</form>
""")

@app.route("/dashboard")
def dashboard():
return "You are logged in!"

@app.route("/add", methods=["GET", "POST"])
def add():
if request.method == "POST":
item = request.form["item"]
return f"Item '{item}' added!"
return render_template_string("""
<form method="POST">
<input name="item" placeholder="Enter item"><br>
<button type="submit">Add Item</button>
</form>
""")

@app.route("/logout")
def logout():
return redirect("/")


if __name__ == "__main__":
app.run(host="0.0.0.0", port=8080)

31 changes: 31 additions & 0 deletions docs/uml/classes_SimpleWebapp.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@startuml class_diagram

class User {
- id: int
- username: str
- password: str
+ is_authenticated(): bool
}

class Item {
- id: int
- title: str
- description: str
+ save(): void
}

class AuthController {
+ login(username: str, password: str): bool
+ logout(): void
}

class ItemController {
+ create_item(data): Item
+ get_item_by_id(item_id: int): Item
}

User "1" -- "0..*" Item : owns
AuthController --> User : authenticates
ItemController --> Item : manages

@enduml
13 changes: 13 additions & 0 deletions docs/uml/sequence_create_item.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@startuml sequence_item
actor User
participant "ItemController" as IC
database "Database" as DB
entity "Item Model" as IM

User -> IC: POST /item/new (title, description)
IC -> IM: Create Item(data)
IM -> DB: INSERT item
DB --> IM: Success
IM --> IC: Item Created
IC -> User: Redirect to item page
@enduml
17 changes: 17 additions & 0 deletions docs/uml/sequence_login.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@startuml sequence_login
actor User
participant "AuthController" as AC
database "Database" as DB
entity "User Model" as UM

User -> AC: POST /login (username, password)
AC -> DB: Query user by username
DB --> AC: User data
AC -> UM: Validate password
UM --> AC: True/False
alt Valid
AC -> User: Redirect to Dashboard
else Invalid
AC -> User: Show error message
end
@enduml
107 changes: 107 additions & 0 deletions evaluasi/blackbox/blackbox_test.side
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"id": "74417e5a-3b64-4741-ba79-e9bb5094c24c",
"version": "2.0",
"name": "Login Test 2",
"url": "https://reimagined-lamp-wr9vj4qjgx47cwpv-8080.app.github.dev/login",
"tests": [{
"id": "3e387499-df2f-44ec-b909-502e620efb3e",
"name": "Untitled",
"commands": [{
"id": "edb35070-2982-4468-a921-d1504c4ee784",
"comment": "",
"command": "open",
"target": "https://reimagined-lamp-wr9vj4qjgx47cwpv-8080.app.github.dev/login",
"targets": [],
"value": ""
}, {
"id": "180d94b9-7652-41da-b540-d159be5ad64e",
"comment": "",
"command": "setWindowSize",
"target": "550x692",
"targets": [],
"value": ""
}, {
"id": "b954e587-310c-4777-a9bf-e02883567b1b",
"comment": "",
"command": "click",
"target": "name=username",
"targets": [
["name=username", "name"],
["css=input:nth-child(1)", "css:finder"],
["xpath=//input[@name='username']", "xpath:attributes"],
["xpath=//input", "xpath:position"]
],
"value": ""
}, {
"id": "d6449a68-c7f8-4af7-b0eb-7b848a907b97",
"comment": "",
"command": "type",
"target": "name=username",
"targets": [
["name=username", "name"],
["css=input:nth-child(1)", "css:finder"],
["xpath=//input[@name='username']", "xpath:attributes"],
["xpath=//input", "xpath:position"]
],
"value": "admin"
}, {
"id": "3e37afb5-a88d-4a52-badd-b421e4542072",
"comment": "",
"command": "click",
"target": "name=password",
"targets": [
["name=password", "name"],
["css=input:nth-child(3)", "css:finder"],
["xpath=//input[@name='password']", "xpath:attributes"],
["xpath=//input[2]", "xpath:position"]
],
"value": ""
}, {
"id": "e5105190-9a67-4761-9d03-967124e77626",
"comment": "",
"command": "type",
"target": "name=password",
"targets": [
["name=password", "name"],
["css=input:nth-child(3)", "css:finder"],
["xpath=//input[@name='password']", "xpath:attributes"],
["xpath=//input[2]", "xpath:position"]
],
"value": "admin"
}, {
"id": "2cec2b09-ed7a-42ac-a1fc-5925d7e7f247",
"comment": "",
"command": "click",
"target": "css=button",
"targets": [
["css=button", "css:finder"],
["xpath=//button[@type='submit']", "xpath:attributes"],
["xpath=//button", "xpath:position"],
["xpath=//button[contains(.,'Login')]", "xpath:innerText"]
],
"value": ""
}, {
"id": "fd837ab6-7b65-43bc-a8e6-41d65ebc0ba9",
"comment": "",
"command": "click",
"target": "name=item",
"targets": [
["name=item", "name"],
["css=input", "css:finder"],
["xpath=//input[@name='item']", "xpath:attributes"],
["xpath=//input", "xpath:position"]
],
"value": ""
}]
}],
"suites": [{
"id": "80d5a14d-44ad-4eb4-9f90-2bd19bf50bf2",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": ["3e387499-df2f-44ec-b909-502e620efb3e"]
}],
"urls": [],
"plugins": []
}
Binary file added evaluasi/blackbox/hasil_test_pass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions evaluasi/blackbox/laporan_blackbox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Laporan Black-Box Testing

## Tujuan
Melakukan pengujian terhadap fitur Login, Tambah Data, dan Logout menggunakan Selenium IDE.

## Langkah Pengujian
1. Membuka halaman `/login`
2. Input username dan password
3. Menekan tombol Login
4. Navigasi ke halaman tambah data
5. Menekan tombol Logout

## Hasil Pengujian
Semua fitur berjalan dengan baik:
- Login: berhasil
- Tambah data: berhasil
- Logout: berhasil

## File Pendukung
- `blackbox_test.side`
- `hasil_test_pass.png`
12 changes: 12 additions & 0 deletions evaluasi/evaluasi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Evaluasi Aplikasi

## Hasil Pengujian
- Semua fitur berjalan dengan baik.
- Tidak ditemukan bug saat pengujian ulang.

## Perbaikan
- Tidak ada perbaikan karena tidak ditemukan error.
(Atau tulis bagian mana yang diperbaiki, jika ada)

## Kesimpulan
Aplikasi berjalan sesuai fungsinya dan siap digunakan untuk pengujian lanjutan.
15 changes: 15 additions & 0 deletions evaluasi/lisensi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Evaluasi Etika & Lisensi

## Jenis Lisensi
Proyek asli menggunakan lisensi **MIT**.

## Keselarasan Pengubahan
MIT adalah lisensi permisif yang mengizinkan modifikasi, distribusi ulang, dan penggunaan untuk keperluan apapun selama atribusi kepada pembuat asli tetap dicantumkan.

Pengubahan yang dilakukan pada proyek ini:
- Bersifat pengembangan fungsionalitas kecil
- Tidak menghapus atribusi dari proyek asli
- Tidak melanggar isi dari lisensi MIT

### Kesimpulan:
Perubahan yang saya lakukan **kompatibel** dengan lisensi MIT.
Binary file added evaluasi/sus/Screenshot 2025-06-28 144401.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added evaluasi/sus/grafik_sus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions evaluasi/sus/laporan_sus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Laporan Usability Study (SUS)

## Responden
- Jumlah: 2 responden (A dan B)

## Hasil Skor SUS
- Responden A: 82.5
- Responden B: 92.5
- **Rata-rata: 87.5**

## Interpretasi
Berdasarkan skala adjective SUS:
- Skor 87.5 termasuk dalam kategori **"Excellent"** (atau “Sangat Baik”).
- Artinya, aplikasi dinilai sangat usable oleh pengguna.

## Grafik Hasil
![grafik](./grafik_sus.png)
Binary file added evaluasi/whitebox/hasil_test_pass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions evaluasi/whitebox/laporan_whitebox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Laporan White-Box Testing

## Metode
Pengujian menggunakan unit test Python (unittest) pada 4 skenario:
- Akses halaman utama
- Akses form login
- Login sukses
- Login gagal

## Hasil
Seluruh test berhasil dijalankan tanpa error.

## Kesimpulan
Fungsi-fungsi utama aplikasi berjalan sesuai yang diharapkan. Validasi login sudah bekerja baik, termasuk handling untuk input salah.
Binary file added out/classes_SimpleWebapp/classes_SimpleWebapp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/__pycache__/test_app.cpython-312.pyc
Binary file not shown.
32 changes: 32 additions & 0 deletions tests/test_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import unittest
from app import app

class FlaskAppTestCase(unittest.TestCase):
def setUp(self):
self.client = app.test_client()
self.client.testing = True

def test_home(self):
response = self.client.get('/')
self.assertEqual(response.status_code, 200)
self.assertIn(b'Welcome', response.data)

def test_login_page(self):
response = self.client.get('/login')
self.assertEqual(response.status_code, 200)
self.assertIn(b'Username', response.data)

def test_login_success(self):
response = self.client.post('/login', data=dict(
username='admin', password='admin'
), follow_redirects=True)
self.assertIn(b'You are logged in', response.data)

def test_login_fail(self):
response = self.client.post('/login', data=dict(
username='wrong', password='wrong'
), follow_redirects=True)
self.assertIn(b'Login failed', response.data)

if __name__ == '__main__':
unittest.main()