CSC/ECE 517 Spring 2016 E1624 Compose functional tests for Suggest topics of student functionality

From Expertiza_Wiki
Jump to navigation Jump to search

This wiki page is for the description of changes made under E1624 Final project design assignment for Spring 2016, CSC/ECE 517.


Problem Statement

What it does

Suggested topic functionality is designed for students to suggest topics they interested in. An assignment can be set up to allow students to suggest topics at the discretion of the instructor. Then, students can suggest topics, and add related descriptions. The proposer can state that (s)he wants to work on the suggested topic. When the instructor approves a suggested topic, if the proposer wanted to work on it, it is assigned to the proposer. Otherwise, it is placed on the signup sheet for anyone to reserve. The purpose of suggested topic is to make the writing assignment more personalized.

What’s wrong with it

Currently, there is no functional test for student's topic suggestion function.

What needs to be done

  • Understand the flow of the suggested topic function.
  • Do not use the development DB, otherwise the tests will not pass on TravisCI.
  • Create RSpec file in /spec/features/ folder.
  • Use fixtures to create the assignment record and any other records such as participant records in test DB.
  • Use Capybara to write functional tests for these three scenarios.
    • One team is on the waitlist. They sent a suggestion for new topic and they want to choose their suggested topic. After their suggested topic is approved, they should leave the waitlist and hold their suggested topic;
    • One team is holding a topic. They sent a suggestion for new topic and they want to choose their suggested topic. After their suggested topic is approved and they choose to switch to suggested topic, they will hold suggested topic and their old topic will be released. And if another team is in waitlist of that old topic, that team should hold the old topic now;
    • One team is holding a topic. They sent a suggestion for new topic and they do not want to work on their suggested topic. After their suggested topic is approved and they choose to public suggested topic, they will still hold their old topic. Their suggested topic will be added in sign-up sheet.
  • Create multiple tests to check valid and invalid cases.


Capybara Based Test Design

To test the functionality of student's suggest topic, we plan to use Capybara to write the test code for each step listed below, covering all three scenarios. (We wish to add some UI screenshots for each step, for better illustration, but seems the file upload function of this expertiza wiki is available for student user level so far.)

Prerequisites

In the project, we assume that an instructor account instructor6 and a student account student11 is already created.

Flow of suggest topic function

Step 1 Use instructor to add a course with topic suggestion enabled

First step is to login with the instructor account (instructor6 here), and then create a course with the new public assignment function. We will create the assignment and edit the topic feature to enable the topic suggestions function for student, where in the UI, it means select the "Allow topic suggestions from students?" checkbox. Also, to test the second and third scenarios that the student already hold a topic, we will add a new topic with 1 slot for testing the later two scenarios. After all above are done, the course just created can be saved to the test database.

In this step, we need to write two functional tests: one is to check whether the course can be added and does the added one have topic suggestion enabled, the other one is to check whether the topic is added by instructor with 1 slot.


Step 2 Add student to the course

After the course is added, the student (student11 for this test project) will be added as participants to the course. For UI test, it should be entering "student11" as the participant name with the "participant" choice selected then click "add" button.

In this step, we need to test whether the student, named student11, is added to the course correctly.


Step 3.1 Use student to suggest a new topic without holding any topic

For the first scenario, which the student does not holding any topic, we should test after login with student11 account and choose the assignment just created by instructor6. Then, we will suggest a topic with the choice of "Yes" for the question Do you wish to work on this topic? and submit the new topic suggestion.

In this step, we need to write the function test to check whether the new topic is added and the student is willing to work on this topic if it is approved.


Step 3.2 Use student to suggest a new topic holding a topic and wish to switch

For the second scenario, we should first let the student login and Signup the only topic created by the instructor in the Signup sheet. Then do the same thing as depict in Step 3.1.

In this step, we need to write two function tests: one is to check whether the student is already on the student list the topic, and the other one is to check whether the topic's available slots of the topic is 1 and the max number of slots is 2.


Step 3.3 Use student to suggest a new topic holding a topic and do NOT wish to switch

For the third scenario, we should do the same thing as introduced in Step 3.2, but the only difference is to select the choice of "No" for the question Do you wish to work on this topic?.

In this step, we also need to write two function tests: one is to check whether the student is already on the student list the topic, and the other one is to check whether the topic's available slots of the topic is 0 now and the max number of slots is 2.


Step 4 Approve/Reject the suggested topic

The approve/reject functions should also be tested by using the instructor6 account. After login the instructor account, use the assignment view suggestions function to view and then approve/reject the new suggested topic.

In this step, we need to write two function tests: one is to check whether the Signup sheet does have/not have the suggested topic if it is approved/rejected, the other one is to check whether in the student suggest new topics, the topic suggested by student11 is indeed approved/rejected accordingly.

Note that, this step is the final test step for the case of suggested topic is rejected. The following 3 possible step 5 is for the case the suggested topic is approved.



Step 5.1 Student did not holding any topic before suggestion

In addition to step 4, since the choice is "Yes" for willing to work on this topic when the student suggested, we will also need to test whether the student is already on the list of the new suggested topic and the number of available slot of the new suggested topic is 0.


Step 5.2 Student held a topic but NOT wish to switch to new suggested topic

For the student was holding a topic and do not want to switch, we need to write two tests: one is to check whether the student is still enrolled on the previous holding topic, and the other one is to confirm that the available slot of the new topic suggested topic is 1.


Step 5.3 Student held a topic and wish to switch to new suggested topic

For the student was holding a topic, coupled with the test written for Step 5.1, there is another test need to be written to check whether the slot of the previous held topic is increased by one.