From 563a13e6ffcec496914e3f2bd630c988aba64776 Mon Sep 17 00:00:00 2001 From: jw255 Date: Fri, 20 Apr 2018 18:04:59 +0100 Subject: some work on report --- report/deliverable-3/texts/testing.tex | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'report/deliverable-3/texts/testing.tex') diff --git a/report/deliverable-3/texts/testing.tex b/report/deliverable-3/texts/testing.tex index e3f709b..6eb94f0 100644 --- a/report/deliverable-3/texts/testing.tex +++ b/report/deliverable-3/texts/testing.tex @@ -1,15 +1,2 @@ \section{Testing} -Tests do not currently run on the gitlab server, as the postgres integration with the docker gitlab-ci is still missing. This means any tests run automatically when pushing will fail. \par -When running integration tests locally, please make sure the postgres server is up and running on localhost. -\subsection{Structure} -Testing files were restructured for a more organised and professional approach. All test files end in ``*.\(<\)context\(>\).test.ts'' and were moved to the ``test'' directory. At this moment, ``\(<\)context\(>\)'' includes ``unit'' and ``routes''. Further, they were categorised into \textit{integration} and \textit{unit} tests and moved into corresponding sub-directories. \par -Apart from making test files easier to find, this new structure also allowed us to run specific tests independently to isolate failures and quickly rerun individual tests. For example \texttt{yarn test:routes:auth} runs all authentication tests. -\subsection{Integration Testing} -\texttt{yarn test:routes} -This category of tests targeted the interplay of different server components as it tested server endpoints (routes) rather than internal functions. We aimed to test all routes for responses of success, and various degrees of failure. \par -E.g. \textbf{``auth.routes.test.ts''} tested the authentication middle-ware, checking existing users could log in only with correct usernames, passwords and reauthentication tokens. During our later meetings, we realised that security is a key-component of medical systems, and requires further much more in-depth testing to guarantee safety of patient data. \par -\textbf{``protocol.routes.test.ts''} aims to cover all endpoints specified in the agreed protocol by using the \textit{mocha-each} npm module. This allowed us to write few mocha testing functions iterating over the long list of endpoints, checking HTTP responses to fit the JSON response templates to conform to the protocol. This form of testing is still incomplete. -\subsection{Unit Testing} -\texttt{yarn test:unit} -The main motivation for this category of tests was to find bugs early on without having to run the whole server. This saves time and uncovers new code breaking old functionality. We also found that unit tests improved the design process by forcing implementation of code that is testable. Furthermore, unit tests were often used as a form of documentation, as it aided in understanding how code of other team members worked and could be used. \par -We decided that each team-member was responsible for creating the unit tests for their code. Unfortunately the number and coverage of unit tests is still quite low. This may be the result of prioritising functionality over bug-resilience and test-driven development. +The test-suite for our project had some major work done since the last submission, allowing tests to run on the Gitlab server as well as addressing bugs in the test-suite and implementation. \ No newline at end of file -- cgit v1.2.1 From 0e486d5178e3a545f3f84273fd1e17354f9899b9 Mon Sep 17 00:00:00 2001 From: jw255 Date: Fri, 20 Apr 2018 23:15:51 +0100 Subject: structure --- report/deliverable-3/texts/testing.tex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'report/deliverable-3/texts/testing.tex') diff --git a/report/deliverable-3/texts/testing.tex b/report/deliverable-3/texts/testing.tex index 6eb94f0..6bc6411 100644 --- a/report/deliverable-3/texts/testing.tex +++ b/report/deliverable-3/texts/testing.tex @@ -1,2 +1,4 @@ \section{Testing} -The test-suite for our project had some major work done since the last submission, allowing tests to run on the Gitlab server as well as addressing bugs in the test-suite and implementation. \ No newline at end of file +The test-suite for our project had some major work done since the last submission, allowing tests to run on the Gitlab server as well as addressing bugs in the test-suite and implementation. +\subsection{Integration Testing} +\subsubsection{CORS} \ No newline at end of file -- cgit v1.2.1 From 1afa6be7f6293501475f2bd387df6fd314fd2702 Mon Sep 17 00:00:00 2001 From: Hafeez Date: Sat, 21 Apr 2018 20:09:52 +0100 Subject: added testing section for report --- report/deliverable-3/texts/testing.tex | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'report/deliverable-3/texts/testing.tex') diff --git a/report/deliverable-3/texts/testing.tex b/report/deliverable-3/texts/testing.tex index 6bc6411..5389a3c 100644 --- a/report/deliverable-3/texts/testing.tex +++ b/report/deliverable-3/texts/testing.tex @@ -1,4 +1,9 @@ \section{Testing} -The test-suite for our project had some major work done since the last submission, allowing tests to run on the Gitlab server as well as addressing bugs in the test-suite and implementation. +Testing was a key process in the development of the final product just as it was in previous submission. Testing was particular important to determine whether the final system meets the requirements initially set. As well as testing each module individually, further tests were done upon completing the system through integration with the front-end and machine learning systems. + +\subsection{Using Mocha and Postman} +The JavaScript framework Mocha was still used in the testing process for modules. The test-suite for our project had some major work done since the last submission, allowing tests to run on the Gitlab server as well as addressing bugs in the test-suite and implementation. Whilst also using Mocha for Unit tests, it was used to test the individual routes and their response whilst comparing them to a template. The same method was applied to test requests. This automation increased the efficiency of production, however, the small amount of routes to test allowed us to be more thorough by manually sending requests to the server using Postman. Postman is a API development tool which allows requests to be sent through an easily manageable user interface. By doing this, expected values were easy to match with actual values, and further bugs could be caught even when the templates had matched previously. \subsection{Integration Testing} -\subsubsection{CORS} \ No newline at end of file +Once the system had been fully implemented and tested, it was necessary to integrate with the rest of the system such as user interface and the machine learning servers. This allowed us to determine whether specific protocols were implemented correctly and to ensure that all the requirements set by the client were met. To begin the integration process, the server was hosted through the St Andrews web service which allows content to be hosted through the web. This was done by configuring an \textit{nginx} proxy that would allow binding of the loopback address and port number. Using \texttt{tmux}, the session was hosted persistently as it allows terminal sessions to be detached and run in the background. From here, it was possible for other teams to send requests to the running server. +\subsubsection{CORS} +Integration testing also gave the opportunity to find additional errors specifically caused by the linking of servers. An example of this is the realisation of the lack of Cross-Origin support. The running server could not function properly as content requests were being sent to different origins and for security reasons this is not permitted. To fix this additional features were required to be implemented to support CORS. Specifically certain headers were added to permit different origin access. \ No newline at end of file -- cgit v1.2.1 From b8a52de8b944e06fb76c563d35c071518bae2751 Mon Sep 17 00:00:00 2001 From: Hafeez Date: Sat, 21 Apr 2018 20:12:15 +0100 Subject: added to testing --- report/deliverable-3/texts/testing.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'report/deliverable-3/texts/testing.tex') diff --git a/report/deliverable-3/texts/testing.tex b/report/deliverable-3/texts/testing.tex index 5389a3c..94d7dbc 100644 --- a/report/deliverable-3/texts/testing.tex +++ b/report/deliverable-3/texts/testing.tex @@ -4,6 +4,6 @@ Testing was a key process in the development of the final product just as it was \subsection{Using Mocha and Postman} The JavaScript framework Mocha was still used in the testing process for modules. The test-suite for our project had some major work done since the last submission, allowing tests to run on the Gitlab server as well as addressing bugs in the test-suite and implementation. Whilst also using Mocha for Unit tests, it was used to test the individual routes and their response whilst comparing them to a template. The same method was applied to test requests. This automation increased the efficiency of production, however, the small amount of routes to test allowed us to be more thorough by manually sending requests to the server using Postman. Postman is a API development tool which allows requests to be sent through an easily manageable user interface. By doing this, expected values were easy to match with actual values, and further bugs could be caught even when the templates had matched previously. \subsection{Integration Testing} -Once the system had been fully implemented and tested, it was necessary to integrate with the rest of the system such as user interface and the machine learning servers. This allowed us to determine whether specific protocols were implemented correctly and to ensure that all the requirements set by the client were met. To begin the integration process, the server was hosted through the St Andrews web service which allows content to be hosted through the web. This was done by configuring an \textit{nginx} proxy that would allow binding of the loopback address and port number. Using \texttt{tmux}, the session was hosted persistently as it allows terminal sessions to be detached and run in the background. From here, it was possible for other teams to send requests to the running server. +Once the system had been fully implemented and tested, it was necessary to integrate with the rest of the system such as user interface and the machine learning servers. This allowed us to determine whether specific protocols were implemented correctly and to ensure that all the requirements set by the client were met. To begin the integration process, the server was hosted through the St Andrews web service which allows content to be hosted through the web. This was done by configuring an \textit{nginx} proxy that would allow binding of the loopback address and port number. Using \texttt{tmux}, the session was hosted persistently as it allows terminal sessions to be detached and run in the background. The server runs on the domain \textit{har4.host.cs.st-andrews.ac.uk}. From here, it was possible for other teams to send requests to the running server. \subsubsection{CORS} -Integration testing also gave the opportunity to find additional errors specifically caused by the linking of servers. An example of this is the realisation of the lack of Cross-Origin support. The running server could not function properly as content requests were being sent to different origins and for security reasons this is not permitted. To fix this additional features were required to be implemented to support CORS. Specifically certain headers were added to permit different origin access. \ No newline at end of file +Integration testing also gave the opportunity to find additional errors specifically caused by the linking of servers. An example of this is the realisation of the lack of Cross-Origin support. The running server could not function properly as content requests were being sent to different origins and for security reasons this is not permitted. To fix this additional features were required to be implemented to support CORS. Specifically certain headers were added to permit different origin access. -- cgit v1.2.1