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

Final changes to Docs #221

Merged
merged 5 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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 modified docs/images/03_technical_context.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 docs/images/Game_Change.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 docs/images/Game_Old.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 docs/images/HomePage_Change.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 docs/images/HomePage_Old.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 docs/images/KaW.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 docs/images/Lighthouse_Result.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 docs/images/Password_Change.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 docs/images/Password_Old.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: 3 additions & 18 deletions docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// configure EN settings for asciidoc
include::src/config.adoc[]
[.text-justify]
= image:arc42-logo.png[arc42] Template
= image:KaW.png[GameIcon] KaW Docs
:revnumber: 8.2 EN
:revdate: January 2023
:revremark: (based upon AsciiDoc version)
Expand All @@ -29,22 +29,6 @@ ifdef::backend-html5[]
endif::backend-html5[]


include::src/about-arc42.adoc[]

// horizontal line
***

[role="arc42help"]
****
[NOTE]
====
This version of the template contains some help and explanations.
It is used for familiarization with arc42 and the understanding of the concepts.
For documentation of your own system you use better the _plain_ version.
====
****


// numbering from here on
:numbered:

Expand Down Expand Up @@ -96,4 +80,5 @@ include::src/11_technical_risks.adoc[]
// 12. Glossary
include::src/12_glossary.adoc[]


// About arc42
include::src/about-arc42.adoc[]
4 changes: 3 additions & 1 deletion docs/src/03_system_scope_and_context.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ See https://docs.arc42.org/section-3/[Context and Scope] in the arc42 documentat

=== Introduction

The KaW project aims to develop a new experimental version of the Saber y Ganar quiz show for RTVE, led by the software development company HappySw. This project involves creating a web application where users can register, log in, and participate in quiz games. Questions for the quiz will be automatically generated from data available in Wikidata.
The KaW project aims to develop a new experimental version of the "Saber y Ganar" quiz show for RTVE
that involves creating a web application where users can register, log in, and participate in quiz
games. Questions for the quiz will be automatically generated from data available in Wikidata.

=== Business Context

Expand Down
4 changes: 1 addition & 3 deletions docs/src/04_solution_strategy.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ corresponding service that answers that petition and return its value.

| Performance
| Web-app should work smoothly and respond quickly.
|
- Implementing caching mechanisms for Question generation.
- Optimizing database queries through indexing and query optimization techniques.
| Implementing caching mechanisms for Question generation.

| Usability
| The application aims for user-friendly accessibility with an intuitive design.
Expand Down
37 changes: 10 additions & 27 deletions docs/src/06_runtime_view.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -192,34 +192,13 @@ sequenceDiagram

=== User statistics recording scenario

When a user answers a question, the WebApp determines if the answer was correct or not. Then,
that data is sent to the Gateway and then forwarded to the User Service, which is in charge of
updating the Database with the updated user history. This process is repeated for each answer to
a question.

Once the user answer the final question of the game, appart from doing the beforementioned process,
the user history is also updated with the game "highlights" such as time spent playing.
When a user answers the final question, the WebApp determines if the answer was correct or not. Then,
all the data collected from the current game (the WebApp is collecting infromation while playing) is
sent to the Gateway and then forwarded to the User Service, which is in charge of
updating the Database with the updated user history.

This case scenario is also represented on the following diagram:

[mermaid]
....
sequenceDiagram
actor U as User
participant FE as WebApp
participant BE as Gateway
participant HS as User Service
participant DB as UserDatabase

U->>FE: Answers a Question
FE-->FE: Determines if the answer is correct
FE->>BE: Indicates correctness of the answer
BE->>HS: Save the user history
HS->>DB: Updates the user history
....

If the user, answers the final question:

[mermaid]
....
sequenceDiagram
Expand All @@ -229,10 +208,14 @@ sequenceDiagram
participant HS as User Service
participant DB as UserDatabase

U->>FE: Answers final Question
U->>FE: Answer question
FE-->FE: Determines if the answer is correct
FE->>BE: Indicates correctness of the answer.
FE-->FE: Save statistic for question
U->>FE: ... more questions answered ...

U->>FE: Answers final Question
FE->>BE: Indicates End of game.
FE->>BE: Send collected data.
BE->>HS: Save the user history with other endgame statistics.
HS->>DB: Updates the user history
....
104 changes: 98 additions & 6 deletions docs/src/08_concepts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,42 @@ the highest quality standards.
There are many different types of tests and the team has decided to enforce the
following ones:

- Unitary Testing:
- Unitary Testing (included on CI/CD):

Each new code is tested independently to ensure its correct
functionality and not breaking the main project. The testing framework used both
for Backend and Frontend is https://jestjs.io/[Jest] due to its simplicity and its great bound with
Javascript files. Also, the usage of SonarCloud gives us more than security checking,
Javascript files.

Also, the usage of SonarCloud gives us more than security checking,
it also enforces each member of the team to have a good coverage on our code to meet
the quality standards we are required.

- End-to-End Testing:
- End-to-End Testing (included on CI/CD):

Appart from testing functionality, all our code must also meet the required
domain functionality such as registration, login, etc. For that, Jest is used
in combination with https://pptr.dev/[pupeeter] which provides a High-level API
to control browsers and simulate our different User Stories (domain functionality)
that the project requires.

The following functional requirements have been tested:

[circle]
* LOGIN-1: Registered user logs in successfully
* LOGIN-2: Registered user logs in with incorrect password
* PROFILEMGT-1: User updates profile information (profile picture and bio)
* REGISTER-1: The user is not registered in the site
* REGISTER-2: The user is already registered in the site
* GAME-1: The user wants to go to the game menu
* GAME-2: The user wants to start an easy game
* GAME-3: The user wants to start a medium game
* GAME-4: The user wants to start a hard game

The combination of both Unitary and End-to-End tests gives our Application
with enough robustness to meet the expectations of delivering high quality
code.

- Load Testing:

Although our application may not have a huge load of users, one of the quality
Expand All @@ -172,16 +191,89 @@ a light and simple framework to build these kind of tests. Also,the files
generated by it are Java files which eases the tasks due to the vast knowledge of
the team on this programming language.

To see a real workload and how our application behaves to it, it has been carried two different
tests per each case scenario. The first one could be consider a "considerable" amount of
users where 20 users arrive to the application per second during 60 seconds. The second one
is a type of load testing called Stress testing where the Application is put at its maximum
capacity so it breaks. The following results are provided below:

[circle]
* LOGIN-1 (Medium load):
* LOGIN-2 (Huge load):
* REGISTER-1 (Medium load):
* REGISTER-2 (Huge load):
* PROFILECHANGES-1 (Medium load):
* PROFILECHANGES-2 (Huge load):
* HARDGAME (Medium load):
* HARDGAME (Huge load):

As it can be seen, the Application runs smoothly with 1200 concurrent users and it is
more than enough to meet the quality requirements and taking in mind where the Application
is hosted. On the other hand, it is currently impossible to achieve availiability and
performance if 3000 users use our Application.

If more information is needed on how to run those tests, please go
https://github.com/Arquisoft/wiq_en3b/blob/master/webapp/GatlingLT/gettingOurHandsOn.md[here].

- Usability testing

Finally, another crucial part to be tested in our application are usability ones.
With these test, the team tries to deliver high quality functionality to the
users by simply testing with them and examine its behaviour.

The team will select different people to try our application to get Information
on how to improve it, at the end, this application is for them! Also, accesibility
and contrast color checks will be carried out since they are part of any
usability tesing process.
on how to improve it, at the end, this application is for them!

[circle]
* Home page:
As stated by many users, they were a little bit lost when logging in directly into
the application since they have to "guess" where the play button was (it was in navbar).
For that, the team decided to include a direct play button that takes the user to the
Game Page. Also, after checking with contrast tools, the name displayed on the Home
Page was not readable enough, so it was also changed.

image::HomePage_Old.png[OldHomePage,640,480]

image::HomePage_Change.png[NewHomePage,640,480]

[circle]
* Game modes:
Another thing the team noticed is the difficulty of users to select one game mode from
our Game since they did not what did it mean "Easy", "Medium", ... So the team decided
to put a descriptive text in each of the game modes so the user can truly understand
what challengue is facing.

image::Game_Old.png[OldGamePage,640,480]

image::Game_Change.png[NewGamePage,640,480]

[circle]
* Password fields
Some users have been very frustated when registering/logging into our Application
since there was no "See password" button to correct their mistakes when typing. Since
this is a simple yet powerful change to improve the User Experience, the team has decided
to also support that capability.

image::Password_Old.png[OldPasswordPage,640,480]

image::Password_Change.png[NewPasswordPage,640,480]

Usability testing does not ends here since it is needed a real one with lots of users
of different ages and also, taking into account its timing on completing certain tasks.
Although, taking already care of these details makes really the difference.


- Accesibility, color checker and more

Google's automated tool LightHouse is used to perform several of "cross-cutting" tests to
improve the performance and correctness of our web Application.

It has been tested each page of our Application against this tool to see any flaw
into our application, and, as it can be seen
https://github.com/Arquisoft/wiq_en3b/tree/master/docs/lighthouse_results[here],
our game has a very good mark on each one.

image::Lighthouse_Result.png[Lighthouse_Result,640,480]

==== Code generation

Expand Down
6 changes: 6 additions & 0 deletions docs/src/11_technical_risks.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,11 @@ to avoid the rate limit (1000 requests/hr)
| Azure
| The decision of using this platform is fully based on the team's knowdlege. Although, it could not be the best option/approach since other platforms such as AWS or hosting ones can have other benefits.

| Game Logic
| The decision of having our game logic like controlling the points, time played by player, etc; in
the Frontend part may seem a good option when trying to develop a game quickly. Although, it is possible
to add to a single user more points than it should be through programs like POSTMAN, so a backend game
logic could tackle this issue.

|===

2 changes: 0 additions & 2 deletions docs/src/12_glossary.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ See https://docs.arc42.org/section-12/[Glossary] in the arc42 documentation.
|Kanban
|A project management method used to visualize workflow.

|CSS Frameworks
|Pre-designed styles and components for building responsive and visually appealing user interfaces.
|Gatling
|A load testing tool used to simulate a great amount of users accessing and using our system.
|===
12 changes: 6 additions & 6 deletions docs/src/about-arc42.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

:keywords: software-architecture, documentation, template, arc42

// horizontal line
***

:numbered!:
**About arc42**

[role="lead"]
arc42, the template for documentation of software and system architecture.

Template Version {revnumber}. {revremark}, {revdate}
This documentation is based on arc42 template for documentation of software and
system architecture. Template Version {revnumber}, {revdate}

Created, maintained and (C) by Dr. Peter Hruschka, Dr. Gernot Starke and contributors.
See https://arc42.org.

See https://arc42.org.
2 changes: 1 addition & 1 deletion docs/src/config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
:toc-title: table of contents

// enable table-of-contents
:toc:
:toc: left

// where are images located?
:imagesdir: ./images
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public class ChangeProfileSimulation extends Simulation {
);

private final static String uri1 = "localhost";
private final static int nUsersStored = 100;
private final static int nUsersStored = 3000;
private final static int waitAfterLogIn = 1;


Expand All @@ -111,12 +111,12 @@ public class ChangeProfileSimulation extends Simulation {
.exec(changeBio(), pause(2))
.exec(enterProfile());

// It works but take in mind to change the token in headers_7
// It works but take in mind to change the token in headers_18
// I have seek ways to do it, but it seems that Gatling does not load the JSON responses in
// logIn()
public ChangeProfileSimulation(){
MongoHandler.getInstance().addNUsers(nUsersStored);
setUp(scn.injectOpen(constantUsersPerSec(5).during(20))).protocols(httpProtocol);
setUp(scn.injectOpen(constantUsersPerSec(50).during(60))).protocols(httpProtocol);
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
MongoHandler.getInstance().flush();
}));
Expand Down
10 changes: 7 additions & 3 deletions webapp/GatlingLT/src/test/java/kaw/HardGameSimulation.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,25 @@ public class HardGameSimulation extends Simulation {

private static final String urlWiki = "https://commons.wikimedia.org/wiki/Special:FilePath";
private static final int waitAfterLogIn = 2;
private final static int nUsersStored = 100;
private final static int nUsersStored = 3000;
private final static String uri1 = "localhost";

private ScenarioBuilder scn = scenario("kaw.HardGameSimulation")
.exec( goToLoginPage(), pause(5) )
.exec( logIn() )
.exec( requestQuestions(), pause(5) )
.exec(updatingHistory());
/*
.exec(getFlagNorway(), pause(5) )
.exec(getFlagBetis(), pause(5) )
.exec(getFlagVanuatu(), pause(5))
.exec(updatingHistory());

*/


public HardGameSimulation(){
MongoHandler.getInstance().addNUsers(nUsersStored);
setUp(scn.injectOpen(constantUsersPerSec(5).during(20))).protocols(httpProtocol);
setUp(scn.injectOpen(constantUsersPerSec(50).during(60))).protocols(httpProtocol);
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
MongoHandler.getInstance().flush();
}));
Expand Down
4 changes: 2 additions & 2 deletions webapp/GatlingLT/src/test/java/kaw/LogInSimulation.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class LogInSimulation extends Simulation {

private static final int waitBeforeLogIn = 2;
private static final int waitAfterLogIn = 10;
private static final int nUsersStored = 10;
private static final int nUsersStored = 3000;

private final ScenarioBuilder scn = scenario("Load Test - LogIn")
.exec(goToLoginPage(), pause(waitBeforeLogIn))
Expand All @@ -69,7 +69,7 @@ public class LogInSimulation extends Simulation {
// the equation equal.
public LogInSimulation() {
MongoHandler.getInstance().addNUsers(nUsersStored);
setUp(scn.injectOpen(constantUsersPerSec(2).during(5))).protocols(httpProtocol);
setUp(scn.injectOpen( constantUsersPerSec(50).during(60))).protocols(httpProtocol);
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
MongoHandler.getInstance().flush();
}));
Expand Down
4 changes: 2 additions & 2 deletions webapp/GatlingLT/src/test/java/kaw/RegisterSimulation.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class RegisterSimulation extends Simulation {

private static final String uri1 = "localhost";
private static final int waitBeforeRegister = 2;
private static final int nUsersRegistering = 600;
private static final int nUsersRegistering = 3000;

private ScenarioBuilder scn = scenario("RegisterSimulation")
.exec(goToLoginPage(), pause(waitBeforeRegister))
Expand All @@ -58,7 +58,7 @@ public class RegisterSimulation extends Simulation {

// Registering 10 users per second during 600s = In the end, 600 users will be registered
public RegisterSimulation(){
setUp(scn.injectOpen(constantUsersPerSec(10).during(60)).protocols(httpProtocol));
setUp(scn.injectOpen(constantUsersPerSec(50).during(60)).protocols(httpProtocol));
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
MongoHandler.getInstance().flush();
}));
Expand Down
Loading