From 9f91dee4d33443cefd0dfaabc18900b4fe0bc9b2 Mon Sep 17 00:00:00 2001 From: Nahlam4 Date: Wed, 12 Jun 2024 22:18:22 +0200 Subject: [PATCH 1/5] Fix sharing from posts on userpage --- src/main/web/src/scenes/User/UserPost.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/web/src/scenes/User/UserPost.tsx b/src/main/web/src/scenes/User/UserPost.tsx index 8683e926..fd953e77 100644 --- a/src/main/web/src/scenes/User/UserPost.tsx +++ b/src/main/web/src/scenes/User/UserPost.tsx @@ -35,7 +35,6 @@ export const UserPost: React.FC = (props: PostModel) => { const [comments] = useState(commentAmount); const [menuOpen, setMenuOpen] = useState(false); const [shareWindowOpen, setShareWindowOpen] = useState(false); - const currentPageURL: string = window.location.href; const location = useLocation(); const [shortDescription, setShortDescription] = useState(''); const searchParams: URLSearchParams = new URLSearchParams(window.location.search); @@ -247,7 +246,7 @@ export const UserPost: React.FC = (props: PostModel) => { )} {shareWindowOpen && (
- +
)} {reportOpen && ( From cbf56159aa5c1e5c0cd2eaf3228f80f12b89574e Mon Sep 17 00:00:00 2001 From: FurkanK <122597204+FurKay00@users.noreply.github.com> Date: Wed, 12 Jun 2024 23:38:54 +0200 Subject: [PATCH 2/5] Update METRICS_REPORT.md --- docs/METRICS_REPORT.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/METRICS_REPORT.md b/docs/METRICS_REPORT.md index 9b90475b..43a5a284 100644 --- a/docs/METRICS_REPORT.md +++ b/docs/METRICS_REPORT.md @@ -2,10 +2,12 @@ ## Metrics Report In this document, we are reporting the results of the additional metrics we have chosen for DHBWhub. -### Coupling +### Relation among classes +We have used the tool [ck](https://github.com/mauricioaniche/ck) to calculate metrics such as the depth of the inheritance tree, number of children, method inheritance factor and response for class. These are the results: + -### Web Application Performance +### Web Application Performance and Monitoring We have used the web extension 'PageSpeed Insights' to evaluate our website in regards to its rendering and response performance. The following image contains the result for the current state of our application: ![grafik](https://github.com/SE-TINF22B6/DHBWhub/assets/122597204/926b8fe6-249c-4f37-8ab8-a33762f730e6) @@ -13,5 +15,3 @@ We have used the web extension 'PageSpeed Insights' to evaluate our website in r The high score on best practices is just what we wanted to achieve with our component based architecture on the frontend. The low score on the response time was quite expected, since there are several reasons for it: 1. On the homepage, all the posts are retrieved from the database every time you enter it or refresh the tab. The reason is to provide consistent data which is conform to the data in the database. 2. Our backend is located on a BWcloud server which was provided for free for every student in the region. Thus, there are obviously restrictions regarding the request and response times between the backend and the frontend. - -### Web Application Monitoring From faf07200e9e44fe93a21f5d70a5e30b8b87eb3f1 Mon Sep 17 00:00:00 2001 From: FurkanK <122597204+FurKay00@users.noreply.github.com> Date: Thu, 13 Jun 2024 08:26:38 +0200 Subject: [PATCH 3/5] Update TEST_REPORT.md --- docs/TEST_REPORT.md | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/docs/TEST_REPORT.md b/docs/TEST_REPORT.md index fb265a83..1fa60541 100644 --- a/docs/TEST_REPORT.md +++ b/docs/TEST_REPORT.md @@ -31,7 +31,13 @@ In the backend, we are planning to check for each function, whether they are tra ### 4. Test Cases All the tests that are depicted in the next subtopics have already passed, since we only launch new features to our main branch, whenever all the relevant tests have passed. #### 4.1 Frontend -> TODO +We have decided to only test the service classes automatically in the frontend. One reason for this is that we prioritized, that the requested data is mapped and transformed into the right data model. Moreover, when testing new functions in the frontend, we already use the whole application via node.js, which reacts just like what our actual website would react like. Thus, we can prove our new functions by testing out manually on the actual frontend on our own branch, before pushing it to the main branch. +One example for an automated test on the frontend looks like this: + +![FrontendTest](https://github.com/SE-TINF22B6/DHBWhub/assets/122597204/69a1521e-1502-4429-89f6-cbbbabae9df7) + +Hereby, we are mocking the eventhandler with jest, and test whether a new editable tag appears on the post editor, after a valid one has been entered by the user. + #### 4.2 Backend Each layer in the backend consists of similar test structures. Thus, we will show you an example for each layer, that is applicable for all the other entity models in our project. #### Controller @@ -51,8 +57,10 @@ Basically the same as the tests in the service layer, since the repositories use ### 5. Test Results #### Frontend -> Todo - +In the following image, you can see all the test regarding the DescriptionService class running at the same time. + +![SingleTest](https://github.com/SE-TINF22B6/DHBWhub/assets/122597204/50969957-8fa3-4c3a-85fb-bba9ca503a72) + #### Backend In the following image, you can see an example of running all the tests related to the AccountController at the same time. JUnit shows whether each test has passed and if yes, how long did it take. @@ -60,7 +68,10 @@ In the following image, you can see an example of running all the tests related ### 6. Metrics #### Frontend -> Todo +In the following image, you can see all the test suites run at once. + +![RunAllTests](https://github.com/SE-TINF22B6/DHBWhub/assets/122597204/df0ac362-6b32-4131-ab41-1720eda34c1c) + #### Backend When building the local version of the project that contains the newly implemented feature, Maven automatically runs all the tests that are located in the test package. The same applies to creating pull requests in which a maven pipeline does the same function and tells all the developers, whether all the tests in the branch function correctly: @@ -68,6 +79,8 @@ When building the local version of the project that contains the newly implement ### 7. Recommendations Although our current tests can verify that components function properly under certain conditions, it is still important to use our actual product as much as possible. The largest amount of bugs and errors can be found through actual interaction with the website and imitation of an actual client user. Stress tests can also be helpful to determine, whether our database and backend connection is strong enough to handle multiple requests at the same time while also maintaining data coherence. + ### 8. Conclusion -> This section summarizes the key findings of the testing and the overall status of the software quality. -> TODO towards the end +- Automated backend tests are definitily easier to make, since we only regard the correct transformation of the data. +- On the frontend however, automated tests are only partly necessary. Manual testing is more important and easier to execute. +- There are some factors, that can't be tested automatically like stable network connections or response latency when retrieving lots of data back to back from the database or backend. From 38acba63620573dfd4e4361b45ecc6ce04ee15ba Mon Sep 17 00:00:00 2001 From: denniskp <122602355+denniskp@users.noreply.github.com> Date: Thu, 13 Jun 2024 09:24:41 +0200 Subject: [PATCH 4/5] fix: image check --- .../de/tinf22b6/dhbwhub/service/PostServiceImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/tinf22b6/dhbwhub/service/PostServiceImpl.java b/src/main/java/de/tinf22b6/dhbwhub/service/PostServiceImpl.java index 23aacb89..d351768b 100644 --- a/src/main/java/de/tinf22b6/dhbwhub/service/PostServiceImpl.java +++ b/src/main/java/de/tinf22b6/dhbwhub/service/PostServiceImpl.java @@ -71,19 +71,20 @@ public Post create(PostProposal proposal) { public HomepagePostPreviewProposal create(CreatePostProposal proposal) { // Creating the Post itself User user = userRepository.findByAccountId(proposal.getAccountId()); - if(user == null){ + if (user == null) { throw new NoSuchEntryException("User with the AccountId " + proposal.getAccountId() + " does not exist!"); } - Picture picture = !proposal.getPostImage().isEmpty() ? - pictureRepository.save(PictureMapper.mapToModelPost(proposal.getPostImage())): null; - Post post = repository.save(PostMapper.mapToModel(proposal,user,picture)); + Picture picture = proposal.getPostImage() != null ? + pictureRepository.save(PictureMapper.mapToModelPost(proposal.getPostImage())) : null; + + Post post = repository.save(PostMapper.mapToModel(proposal, user, picture)); // Creating Tags after the Post is created Arrays.stream(proposal.getTags()).forEach(t -> { PostTag postTag = new PostTag(post, t); postTagRepository.save(postTag); - } ); + }); return getPostHomepageView(post.getId()); } From 2d863e0c464d485f1c37511957e918cdd9c04e09 Mon Sep 17 00:00:00 2001 From: Nahlam4 <118728701+Nahlam4@users.noreply.github.com> Date: Thu, 13 Jun 2024 09:32:23 +0200 Subject: [PATCH 5/5] slightly change sharing link of user posts --- src/main/web/src/scenes/User/UserPost.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/web/src/scenes/User/UserPost.tsx b/src/main/web/src/scenes/User/UserPost.tsx index fd953e77..709eb48c 100644 --- a/src/main/web/src/scenes/User/UserPost.tsx +++ b/src/main/web/src/scenes/User/UserPost.tsx @@ -246,7 +246,7 @@ export const UserPost: React.FC = (props: PostModel) => { )} {shareWindowOpen && (
- +