Workflow addition: to_be_tested -> in_testing with Tester field
|Reported by:||Owned by:|
I wanted to be able to have a Tester assigned to a ticket in addition to submitter and owner.
I added the field (in trac.ini):
[ticket-custom] tester = text tester.label = Tester
and added the workflow (in trac.ini):
# owner sets the ticket to be tested tobetested = new,accepted,needs_work -> tobetested tobetested.name = Submit for testing tobetested.permissions = TICKET_MODIFY # tester accepts the ticket for testing # Tester is set to Tester field testing = tobetested -> testing testing.name = Accept for testing testing.operations = set_tester_to_self testing.permissions = TICKET_MODIFY # Tester rejects reject = testing -> needs_work reject.name = Failed testing reject.permissions = TICKET_MODIFY # Tester passes pass = testing -> closed pass.name = Passed Testing pass.operations = set_resolution pass.set_resolution = fixed pass.permissions = TICKET_MODIFY # Tester unaccepts # Tester field is cleared unaccept = testing -> tobetested unaccept.name = Cancel testing unaccept.operations = del_tester unaccept.permissions = TICKET_MODIFY
Of course, this requires adding support for set_tester_to_self and del_tester, which is done in ticket/default_workflow.py:
... def render_ticket_action_control(self, req, ticket, action): ... if 'set_tester_to_self' in operations: hints.append(_("The tester will change to %s") % req.authname) if 'del_tester' in operations: hints.append(_("Tester will be cleared.")) ... ... def get_ticket_changes(self, req, ticket, action): ... if operation == 'set_tester_to_self': updated['tester'] = req.authname elif operation == 'del_tester': updated['tester'] = '' ... ...
I suspect this could be improved for more people by also adding support for set_tester. Maybe it could even be made more generic to allow arbitrary custom field names configured in trac.ini.