def testVelocityForSprint(self): """Tests the set velocity for a sprint as a team metric""" test_team = self.tm.create(name="Team#1") self.assert_true(test_team.save()) self.tmm.create(name="Member#1", team=test_team).save() self.tmm.create(name="Member#2", team=test_team).save() self.tmm.create(name="Member#3", team=test_team).save() sprint = self.teh.create_sprint("TestSprint", team=test_team) us1 = self.teh.create_ticket(Type.USER_STORY, props={Key.STORY_POINTS: '5', Key.SPRINT: sprint.name}) us2 = self.teh.create_ticket(Type.USER_STORY, props={Key.STORY_POINTS: '8', Key.SPRINT: sprint.name}) us3 = self.teh.create_ticket(Type.USER_STORY, props={Key.STORY_POINTS: '13', Key.SPRINT: sprint.name}) # we have to use the TeamController here cmd_store = TeamController.StoreTeamVelocityCommand(self.env, sprint=sprint, team=test_team, estimated=True) self.assert_equals(26, self.controller.process_command(cmd_store)) # Now close a story and check the actual velocity cmd_get = TeamController.GetStoredTeamVelocityCommand(self.env, sprint=sprint.name, team=test_team, estimated=True) us3[Key.STATUS] = Status.CLOSED us3.save_changes('tester', 'closed US3') self.assert_equals(26, self.controller.process_command(cmd_get)) cmd_store.estimated = False self.assert_equals(13, self.controller.process_command(cmd_store)) cmd_get.estimated = False self.assert_equals(13, self.controller.process_command(cmd_get))
def testStoreAndRetriveVelocityCommands(self): """Tests the store and retrive of the team velocity from the metrics""" self.assert_equals('A-Team', self.sprint.team.name) cmd_store_velocity = TeamController.StoreTeamVelocityCommand( self.env, sprint=self.sprint) velocity = self.controller.process_command(cmd_store_velocity) self.assert_equals(13, velocity) # now check if it has been stored cmd_get_velocity = TeamController.GetStoredTeamVelocityCommand( self.env, sprint=self.sprint) metrics_velocity = self.controller.process_command(cmd_get_velocity) self.assert_equals(velocity, metrics_velocity) # now the estimated cmd_store_velocity.estimated = True cmd_get_velocity.estimated = True est_velocity = self.controller.process_command(cmd_store_velocity) self.assert_equals(39, est_velocity) metrics_est_velocity = self.controller.process_command( cmd_get_velocity) self.assert_equals(est_velocity, metrics_est_velocity)