To install StudyMoose App tap and then “Add to Home Screen”
Save to my list
Remove from my list
Testing strategy plan and test cases are applied to BSc Computing Science dissertation project of DimitarStoynev. The project is a web application that allows the lecturers to create exams in different schools and different modules, topics and types of questions – multiple choice, fill the gaps and open answer questions – accompanied with a good description, points and pictures as required. All generated exams and questions are saved in a database and can be accessed at any time from the authorized users.
Laravel is used for the dissertation project because it is a free open - source PHP web framework designed to develop web applications based on the architectural model-view-controller (MVC). The test strategies are applied to functions of the application: createQuestion and deleteQuestion.
MVC separates the application into three main components: model, view, and controller. The model manages fundamental behaviors and information of the application. It will respond to requests for data, reply to instructions to alter the state of its data.
The view effectively provides the user interface component of the application. It’ll render information from the model into a form that is appropriate for the user interface. The controller receives user input and makes calls to model objects and the view to perform appropriate actions. The MVC software architecture, facilitates the testing processes and behavior driven development (BDD), as this clear distinction between components allows us to perform independent component tests to every part of the system. It allows us to go even further and apply unit testing to every class or even methods.
The main goal of this web application is to allow lecturers create exam papers.
Module questions are a fundamental part of the examination, without them exams would not exist. The first step is to select the module to which the question should be added – modules that are only taught by the authenticated lecturer are available. Questions may be from any of the three type: Multiple choice, Open answer and Fill the gaps. They all have two common fields– text and image, but the image is an optional one.
Multiple choice questions require from the user to define a set of answers as more than one can be correct. The answers are sent to the database as an array, which contains the value of the answer and a ‘correct’ value (true or false). Open answer questions do not have answer field – an empty array is posted. Fill the gaps questions are similar to Open answer, but they allow the lecturer to import special symbols into the questions text to specify where the gaps are.
For the purpose of this report Behat is applied as a BDD testing tool. Behat is a tool to test the behavior of the application, described in special language called Gherkin. Gherkin is a Business Readable language created especially for behavior descriptions. It gives you the ability to remove logic details from behavior tests. The parser divides the input into features, scenarios and steps. This tool gives the opportunity to follow the business logic of the software and to make sure the sequence of actions made is correct and that the system responds in the right way.
Appendix 9.1. Bеhat Pseudo Code Testing is a Behat Feature test for the ability of the lecturer to generate a new module question. This test allowed to check if the system is following the required business logic, if some preconditions are met (for example whether the lecturer is logged in) and if the right information is posted to the database.
Black Box Testing is a software testing technique within which the internal structure of the item being tested is not known to the tester. This testing method helps in exposing discrepancies in the specifications, as the tests are performed from the user’s point of view. Furthermore, the tester does not need any knowledge of specific programming language to test the reliability and functionality of an application and the tests can be developed as soon as the specifications are completed (Rongala, 2015.)
For this task the createQuestion() feature is used. The purpose of the function is to allow lecturers add a new module question from any of the three types: Multiple Choice, Open Answer and Fill the Gaps.
Contains Defined Answers | Contains Gaps In the Question Text |
---|---|
True | False |
False | True |
False | False |
Actions | |
Create Multiple Choice Question | X |
Create Fill the Gaps Question | X |
Create Open answer Question | X |
Table 1. Black Box Decision Table
On the other hand, White Box Testing is a software testing technique in which the structure of the item being tested is known to the tester. This testing method is very efficient, because the tester has internal knowledge of the software and maximum coverage is obtained and in this way a lot of hidden errors and problems are found and the code is further optimized (Jorgensen, 2008).
For this task the Delete a Question feature of the Exam Generating web application is used. Appendix 9.2 shows the implementation of deleteQuestion() function from the Lecturer’s Action Controller. This method is responsible for removing a question selected from the lecturer. In the code shows that before the action is executed, the data is passed from the view to the controller undergoes three validations: LaravelValidator, check if the module in which the question to be removed is valid and check if the actual question exists.
Chart 1. White Box Testing Flowchart for deleteQuestion function.
Test Case | Validator | Model | Question | Output |
---|---|---|---|---|
1 | Fail | Pass | Pass | Custom Error Message |
2 | Pass | Fail | Pass | Custom Error Message |
3 | Pass | Pass | Fail | Custom Error Message |
4 | Pass | Pass | Pass | Question Successfully Deleted |
Chart 1 and table 2 above represent information for four possible outcomes of the deleteQuestion() function. It can be seen that in order for the method to successfully delete a question all three conditions need to be satisfied.
Scenario testing is a software testing activity that uses scenarios, similar to the scenarios created by Behat. Theoretic stories are used to assist the tester run through a complex problem or test system. The best scenario check is a credible story the end result of which is straightforward to evaluate (Jorgensen, 2008).
Based on a story about how the program is used.
A stakeholder with influence would push to fix a program that failed this test.
It not only could happen in the real world; stakeholders would believe that something like it probably will happen.
Involves a complex use of the program or a complex environment or a complex set of data.
The results are easy to evaluate:
Scenario: The server is crashes and all exams are deleted.
A lecturer is looking at an examination paper the night before the exam day.
He wants to update the paper.
He adds and removes questions.
The lecturer prints out the exam to be sure it is formatted correctly.
He applies the update to the exam.
The exam paper is ready.
On the next day, when the exam needs to be held, the server which holds the system crashes and all exams are deleted.
Exam papers are not accessible.
Is the exam still held?
On the other hand, exploratory testing is about investigation and learning. It emphasizes personal freedom and responsibility of the individual tester. It takes a closer look at cases that do not seem to be created beforehand (Jorgensen, (2008).
The web application is based on the Iterative model. Each build consisted of developing a new feature as functionality and design, as well as testing it.
Exploratory testing was applied in all builds, but it helped me find a hidden error when the endpoint for a specific module was added to the Lecturers user interface. Using this testing technique it was noticed that changing the module ID in the endpoint redirects the lecturer to a different module, even to a one that is not taught by him. This major flaw in the system was fixed by adding a validation. The function now goes through a check, in which it is tested if the requested module is actually part of the authenticated lecturer profile.
Furthermore, another flaw in the system was noticed with exploratory testing. From the createQuestion() function, mentioned above, it can be seen that each question has an image as an optional field. In the first builds of the system, those images were saved in the database, which is usually a very bad practice, as it overloads the database and it may result in the server crashing or lagging. This problem was fixed by linking the images by the path to the folder where they are actually saved. Moreover, this now allows the user to upload more than one picture for a question.
Security testing is a kind of code testing that intends to uncover vulnerabilities of the system and verify that its information and resources are protected from potential intruders (Wysopal, 2007).
This web application is based on the PHP framework Laravel, which protects the system from SQL injections when using Eloquent model. Laravel does this by creating prepared statements that escape any user input that come through forms in the frontend. If hackers add a replacement input to the form, they may attempt to insert their own custom SQL question to break or browse your application information. This does not work when using the Eloquent model, which will escape this SQL command and the invalid query will be saved as text into the information (Mansuri, 2018).
Laravel makes it simple to protect the system from cross-site request forgery (CSRF) attacks. Cross-site request forgeries are a sort of malicious exploit whereby unauthorized commands are performed on behalf of an authenticated user. Laravel automatically generates a CSRF 'token' for every active user session managed by the application. This token is used to verify that the authenticated user is the one actually creating the requests to the appliance (Mansuri, 2018).
Load testing determines the system's performance under real-life load conditions. This testing helps determine how the application behaves once multiple users access it at the same time. This type of testing is needed in order to check how the web application threats high traffic and if the database can manage high number of requests at the same time.
This testing usually identifies:
This system would be tested with the Webserver Stress Tool, which is a powerful HTTP-client/server check application designed to pinpoint vital performance issues in your web site or internet server which will prevent best experience for your site's visitors.
It simulates the HTTP requests generated by hundreds or even thousands of simultaneous users, you can test your web server performance under normal and excessive loads to ensure that critical information and services are available at speeds your end-users expect (Paessler AG, 2019).
Overall, the testing strategy, applied to the Exam Generation web application, covered several types of tests: BDD, Black Box, White Box, Scenario, Exploratory, Security and Load testing. All this software testing techniques checked different aspects of the performance of either of the two features of the web application: deleteQuestion() and createQuestion().
The testing strategy has a great outcome, because of all those different types of test techniques that were applied. Each testing method covered different aspect of the system ensuring that the same thing is not tested twice. Going over every possible issue that may occur, resulted in the system being more efficient and the code more precise and consistent.
Feature: Create new Open Answer module question
In order to create a new module question
As a lecturer
The lecturer needs to be able to add a new question
Scenario: Creating the question
Given The lecturer is logged in
And The lecturer is on New Question page
When The lecturer selects the Module he would like to create a question for
And The lecturer selects the type of the question
And The lecturer fills in the question text
And The lecturer presses the Create Question button
Then The lecturer has now added a new question and redirected to the Module’s question page
Feature: Create new Multiple Choice module question
In order to create a new module question
As a lecturer
The lecturer needs to be able to add a new question
Scenario: Creating the question
Given The lecturer is logged in
And The lecturer is on New Question page
When The lecturer selects the Module he would like to create a question for
And The lecturer selects the type of the question
And The lecturer fills in the question text
And The lecturer fills in the answer fields
And The lecturer presses the Create Question button
Then The lecturer has now added a new question and redirected to the Module’s question page
public function deleteQuestion(Request $request) {
$validator = Validator::make($request->all(), [
'id' => 'bail|required|numeric',
'module_id' => 'bail|required|numeric'
]);
if($validator->fails()) {
return $this->returnCustomJsonValidatorError($validator);
}
$module = Auth::user()->modules()->where('id', $request->input('module_id'))->first();
if(is_null($module)) {
return response()->json(['success' => false, 'message' => 'Something went wrong. Please, try again later.']);
}
$question = $module->questions()->where('id', $request->input('id'))->first();
if(is_null($question)) {
return response()->json(['success' => false, 'message' => 'Something went wrong. Please, try again later.']);
}
Storage::delete('uploads/'.$question->imageServerName);
$question->delete();
return response()->json(['success' => true, 'message' => 'You have successfully deleted the specified question.']);
}
Comprehensive Testing Strategy for BSc Computing Science Dissertation Project. (2024, Feb 19). Retrieved from https://studymoose.com/document/comprehensive-testing-strategy-for-bsc-computing-science-dissertation-project
👋 Hi! I’m your smart assistant Amy!
Don’t know where to start? Type your requirements and I’ll connect you to an academic expert within 3 minutes.
get help with your assignment