CSC/ECE 517 Spring 2016/Refactor and write unit tests for question type.rb: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
(test)
(problem statement)
Line 1: Line 1:
This wiki page is for the description of changes made under E1608OSS assignment for Spring 2016, CSC/ECE 517.
This wiki page is for the description of changes made under E1608 OSS assignment for Spring 2016, CSC/ECE 517. The assignment task is to  refactor & write unit tests for [question_type].rb (eg. criterion.rb).
 
 
== Problem Statement ==
Files involved: criterion.rb, scale.rb, checkbox.rb, questionnaire_header.rb, upload_file.rb. There are 4 methods “edit”, “view_question_text”, “complete” and “view_completed_question” correspond to different views.
 
edit ~> when instructor add/edit new questions
view ~> when instructor view existed questions
complete ~> when students do peer reviews
view_completed_question ~> when student view existed peer reviews
 
Expertiza question types inheritance hierarchy
Choice question
Scored question
Scale
Criterion
Unscored question
Dropdown
CheckBox
TextResponse
TextArea
TextField
UploadFile
 
What’s wrong with it:  You can click these [question_type].rb files listed above. These links will redirect to Code Climate. You need to fix these issues in each file, such as security, complexity, duplication, etc. And currently there is no unit tests for [question_type].rb.
What needs to be done:
Refactor these [question_type].rb files and fix issues.
Keep the inputs and outputs of these methods (edit, view, complete, view_completed_question) the same as before.
Write unit tests for [question_type].rb listed above.
Create RSpec files for each question type in /spec/models/ folder
Create multiple tests to check valid and invalid cases, such as input including special character double quote (“”).

Revision as of 21:03, 21 March 2016

This wiki page is for the description of changes made under E1608 OSS assignment for Spring 2016, CSC/ECE 517. The assignment task is to refactor & write unit tests for [question_type].rb (eg. criterion.rb).


Problem Statement

Files involved: criterion.rb, scale.rb, checkbox.rb, questionnaire_header.rb, upload_file.rb. There are 4 methods “edit”, “view_question_text”, “complete” and “view_completed_question” correspond to different views.

edit ~> when instructor add/edit new questions view ~> when instructor view existed questions complete ~> when students do peer reviews view_completed_question ~> when student view existed peer reviews

Expertiza question types inheritance hierarchy Choice question Scored question Scale Criterion Unscored question Dropdown CheckBox TextResponse TextArea TextField UploadFile

What’s wrong with it: You can click these [question_type].rb files listed above. These links will redirect to Code Climate. You need to fix these issues in each file, such as security, complexity, duplication, etc. And currently there is no unit tests for [question_type].rb. What needs to be done: Refactor these [question_type].rb files and fix issues. Keep the inputs and outputs of these methods (edit, view, complete, view_completed_question) the same as before. Write unit tests for [question_type].rb listed above. Create RSpec files for each question type in /spec/models/ folder Create multiple tests to check valid and invalid cases, such as input including special character double quote (“”).