CSC/ECE 517 Spring 2014/oss E1406 st: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 84: Line 84:


====teams_controller====
====teams_controller====
Current test cases are as following. The method create_team_view is ignored in testing since in current codes it is never used
Current test cases are as following.
=====Create team with valid name=====
=====Create team with valid name=====
=====Create team with existing name=====
=====Create team with existing name=====
Line 91: Line 91:
=====Update team with valid name=====
=====Update team with valid name=====
=====Update team with existing name=====
=====Update team with existing name=====
=====List available teams=====
=====Inherit team from course to assignment=====
=====Inherit team from course to assignment=====
=====Create/Delete/Update/Inherit should redirect=====
The methods in the following are ignored in testing since they are never used in current codes.
=====create_teams_view=====
=====create_teams=====


==Future Works==
==Future Works==

Revision as of 20:25, 31 March 2014

E1406: Improve tests & investigate regex warnings for team functionality

Please be advised that we do not have deployment link, since our work are all back-end tests

Classes

app/controllers/teams_controller.rb

teams_controller contains functionalities for team management for instructor/TA accounts. Instructor/TA can:

  • view current teams
  • create new teams
  • import/export teams
  • delete all teams/delete specified team
  • copy existing teams from a course down to an assignment(inherit)
  • update team's information

app/controllers/student_team_controller.rb

The student_team_controller support team management for student account. student can

  • create team
  • view current team (including team invitations received and sent)
  • advertise for their team
  • remove the advertise for their team
  • leave the team
  • review members (removed)

Motivation

There were no functional tests written on the two controllers to detect bugs, as well as confirming they are functional by itself and after integration.

Our goal is to add comprehensive functional tests and integration tests to the two controllers to provide a preferable test suite for the future developers.

Also, as the classes are influenced by the changes from other, we are also responsible for fixing some of the bugs, refactoring the method names to a better ones, as well as reporting the bugs found in the testing process.

Tasks

Overall: contribute to the code coverage, ideally having overall coverage increase 2%

student_team_controller

  • write tests
  • def advertise_for_partners # change to “advertise”
  • def remove # change to “remove_advertisment”
  • def review # remove this method

teams_controller

  • write tests

Deployment

Please note that all of our work will be under the /test folder, which means they will not show any change on the view. To see the result of tests, run

rake test TEST=test/functional/student_team_controller.rb

and

rake test TEST=test/functional/teams_controller

running the whole test suite with rake test is not recommended, as the schema change overtime has broke some of the previous tests.

Testing

Framework
Rails default test framework<ref>http://guides.rubyonrails.org/testing.html</ref>
Sample data
Fixtures (under /test/fixtures)
Total Number of Tests
??

Testing Scenarios

student_team_controller

Most of the test case are straightforward. There are some of the test cases was commented out due to bug in the controller

View student team (GET #view)
Edit team (GET #edit)
Create team with valid name (POST #create)
Create team with name in use (POST #create)
Update valid team name (POST #update)
Update team name in use (POST #update)
Update with current team name (POST #update)

This is currently commented out in the committed code. It seems like the method is never called. It raises missing template error upon every call. The advertise method was previously named advertise_for_partners, but renamed due to ambiguity as there is another class with the same name.

Remove advertisement (GET #remove_advertisement )

The remove_advertisement method was previously named remove, but renamed to avoid ambiguity This method is never called as well, but it is functional as it do not require any template.

Leave student team (GET #leave)

This is currently commented out in the committed code, because it will raise error every time when called. It seems like problem happens on

 line 96: other_members = TeamsUser.where( ['team_id = ?', params[:team_id]]).first
 line 97: if other_members.length == 0

This will raise error due to the calling length of other_members, which is a single object but not an array. Also, the related record seems to be remain undeleted in the database.

teams_controller

Current test cases are as following.

Create team with valid name
Create team with existing name
Delete all teams
Delete specified team
Update team with valid name
Update team with existing name
List available teams
Inherit team from course to assignment
Create/Delete/Update/Inherit should redirect

The methods in the following are ignored in testing since they are never used in current codes.

create_teams_view
create_teams

Future Works

student_team_controller

Please note that this bug was reported fixed in the newest version of master branch of expertiza, but the fix came too late

There are several error raised from leave method need to be fixed, as mentioned above. Future teams may need to add tests on it as soon as it fixed, since it is a crucial functionality of the student team.

Also, methods that seems like not being used, such as advertise and remove_advertisement may need to be double checked and see if they are redundant.

References

<references/>