CSC/ECE 517 Spring 2024 - E2413. Testing - Answer Tagging

From Expertiza_Wiki
Jump to navigation Jump to search

E2413. Testing - Answer Tagging

This wiki page is for the description of changes made in Spring 2024, CSC/ECE 517 for the E2413 Testing - Answer Tagging assignment.



Expertiza

In accordance with the Ruby on Rails framework, Expertiza is an open source software project (OSS) led by Dr. Edward Gehringer. Expertiza gives the instructor the ability to create new and edit already existing assignments. Also, the instructor can filter a list of subjects for students to choose. In Expertiza, students can organize into different teams to work on different assignments and projects. Also, students have the capability to peer review as a way for students to evaluate each other's work. Expertiza allows submissions from a variety of document types, such as PDFs, wiki pages and URLs.

Objective

Answer tagging helps determine a few metrics on a student’s responses to a questionnaire. Students can tag these metrics for other students for tone and solutions. The specs mentioned need to be further developed to cover missing methods/lines. Our objective is to add to current tests and write extra tests to cover any edge cases. Also, we had to add detailed explanations for all the tests.

Controller and Spec Files

Answer Tags

Tag Prompt Deployment


Testing Implementation

Answer Tags Controller

This controller answer_tags_controller.rb creates answr tags and tracks the number of tags a student has completed overall per assignment or questionnaire. The controllers' output is a JSON-formatted collection of response tags.

Methods

action_allowed? : Determines if the user has the permission to see all the tags or create_edit a tag.

Use Cases:
* When it is a student session, access to index should be allowed.
* When it is a student session, access to create_edit should be allowed.
* When it is a student session, access to destroy should not be allowed.
Edge Cases:
* When the session is undefined, access to index should be inaccessible.
* When the session is undefined, access to create_edit should be inaccessible.
* When the session is undefined, access to destroy should be inaccessible.

index : Returns all the tag prompt deployments in JSON format

Use Cases:
* When there are no tag prompts deployed, a empty list should be displayed.
* When there is 1 tag prompt deployed, 1 should be displayed.
* When there are tag prompts deployed with no associated assignment answer tag, tag prompts should not be displayed.
* When there is an answer tag associated with an user_id, it should be filtered by an user_id.
* When there is an answer tag associated with an assignment_id, it should be filtered by an assignment_id.
* When there is an answer tag associated with a questionnaire_id, it should be filtered by a questionnaire_id.
* When there is an answer tag associated with an user_id, assignment_id, and questionnaire_id, it should be filtered by a user_id, assignment_id, questionnaire_id.
* When there is no answer tag associated with a assignment_id, no tag prompts are returned for a assignment_id with no associated answer tags.
* When there is no answer tag associated with a questionnaire_id, no tag prompts are returned for a questionnaire_id with no associated answer tags.
Edge Cases:
* When user_id is undefined, an empty list of tags prompts should be returned.
* When assignment_id is undefined, an empty list of tags prompts should be returned.
* When questionnaire_id is undefined, an empty list of tags prompts should be returned.

create_edit : Allow the creation or updating of an answer tag.

Use Cases:
* When a current tag is accessed, the current tag should be updated with new provided values.
* When a current tag is accessed by a student, the current tag should not be updated with new values.
Edge Cases:
* When no mapping is found related to any tag_prompt_deployment for that tag (foreign key constraint), an empty list of tags prompts should be returned.

Tag Prompt Deployment Controller

This controller tag_prompt_deployment.rb is when an instructor is able to view the tagging summary of the users that completed the answer tagging. Not true. It has other purposes as well. Tag prompt deployments indicate that comments are to be tagged for the characteristic specified by the tag prompt.

Methods

tag_prompt : Tests that the tag prompt associated with the provided tag_prompt_id is correctly returned by the tag_dep.tag_prompt method.

Use Cases:
* When given a valid tag_prompt_id, it should return the associated tag prompt with the deployment.
Edge Cases:
* When given an invalid tag_prompt_id, it should not return a tag prompt with the deployment.

get_number_of_taggable_answers : Calculates total taggable answers assigned for a user who participated in ``tag review assignment.

Use Cases:
* When user_id is nil, it should return an error message.
* When answer_length_threshold is null, it should return a count of tangible answers.
* When answer_length_threshold is not null, it should return a count of taggable answers less than answers_one.
Edge Cases:
* When there are no responses, it should return zero as the count of taggable answers.
* When questions are empty, it should return count of taggable answers as zero.

assignment_tagging_progress : Accesses the percentage progress of answer tagging.

Use Cases:
* When there is a team, a question, and the assignment's rubrics do not vary by round, it should calculate the tagging progress for each user.
* When there is a team, a question, and the assignment's rubrics do vary by round, it should calculate the tagging progress for each user considering all tagged items.
Edge Cases:
* When no questions are found, it should return an empty list.
* When there are no teams or questions, it should return an empty list.

Testing Details

Demo Videos

  1. Demo Video for Tag Prompt Deployment Controller
  2. Demo Video for Answer Tag Controller

Using RSpec

We implemented tests in answer_tags_controller_spec.rb and tag_prompt_deployment_spec.rb which offer age 100% coverage for the Answer Tag Controller and the Tag Prompt Deployment Controller.

How to See Test Coverage
  1. Run RSpec for answer_tags_controller_spec.rb, sudo su, yum install lynx, then lynx ./coverage/index.html
  1. Run RSpec for tag_prompt_deployment_spec.rb, sudo su, yum install lynx, then lynx ./coverage/index.html

Results

answer_tags_controller.rb coverage = 100%

tag_prompt_deployment.rb coverage = 100%

Future Work

1. Implement similar test for functionality connected to answer tagging and tag prompt deployment.

References

  1. Expertiza GitHub
  2. Project Repository
  3. Github Project Board
  4. Pull Request
  5. RSpec