def testAboutReport(self): """ Add a bit of blurb to the report """ report_config = {'name': 'reports', 'reports': [{'metric': 'cumulative-throughput', 'description': 'All about flow', 'categories': 'foreach', 'types': 'foreach'}], 'format': 'xlsx', 'counts_towards_throughput': [], 'location': self.workspace, 'types': {'failure': ['Bug', 'Fault'], 'value': ['New Feature', 'Story', 'Improvement'], 'oo': ['Task', 'Decision', 'User Support', 'Spike']}} publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue(os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format(spreadsheet=actual_output)) workbook = xlrd.open_workbook(actual_output) expected_sheet_name = 'cumulative-throughput' self.assertEqual(expected_sheet_name, workbook.sheet_names()[0]) worksheet = workbook.sheet_by_name(expected_sheet_name) actual = worksheet.cell_value(rowx=0, colx=5) expected = report_config['reports'][0]['description'] self.assertEqual(actual, expected)
def testOutputFailureDemandToExcel(self): report_config = {'name': 'reports', 'reports': [{'metric': 'demand', 'categories': 'foreach', 'types': ['failure']}], 'format': 'xlsx', 'location': self.workspace, 'counts_towards_throughput': [], 'types': {'failure': ['Bug', 'Fault'], 'value': ['New Feature', 'Story', 'Improvement'], 'oo': ['Task', 'Decision', 'User Support', 'Spike']}} publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue(os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format(spreadsheet=actual_output)) # with a sheet containing the throughput data workbook = xlrd.open_workbook(actual_output) self.assertEqual('failure-demand', workbook.sheet_names()[0])
def testOutputCycleTimeToExcel(self): report_config = { 'name': 'reports', 'reports': [{ 'metric': 'cycle-time', 'categories': 'foreach', 'types': ['value'], 'cycles': ['develop'] }], 'format': 'xlsx', 'location': self.workspace } publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue( os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format( spreadsheet=actual_output)) # with a sheet containing the throughput data workbook = xlrd.open_workbook(actual_output) self.assertEqual('value-develop-cycle-time', workbook.sheet_names()[0])
def testOutputArrivalRateToExcel(self): report_config = { 'name': 'reports', 'reports': [{ 'metric': 'arrival-rate' }], 'format': 'xlsx', 'location': self.workspace } publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue( os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format( spreadsheet=actual_output)) workbook = xlrd.open_workbook(actual_output) expected_sheet_name = 'arrival-rate' self.assertEqual(expected_sheet_name, workbook.sheet_names()[0]) worksheet = workbook.sheet_by_name(expected_sheet_name) header_row = worksheet.row(0) expected_headers = ['one', 'two', 'three']
def testOutputCFDToExcel(self): report_config = { 'name': 'reports', 'states': [], 'reports': [{ 'metric': 'cfd' }], 'format': 'xlsx', 'counts_towards_throughput': [], 'location': self.workspace } publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue( os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format( spreadsheet=actual_output)) # with a sheet containing the throughput data workbook = xlrd.open_workbook(actual_output) self.assertEqual('cfd', workbook.sheet_names()[0])
def testCfdDefaultColours(self): report_config = { 'name': 'reports_default', 'states': ['open', 'in progress', 'closed'], 'reports': [{ 'metric': 'cfd' }], 'format': 'xlsx', 'location': self.workspace } publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports_default.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue( os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format( spreadsheet=actual_output)) self.compareExcelFiles(actual_output, expected_filename)
def testCumulativeThroughputGraph(self): report_config = { 'name': 'reports', 'reports': [{ 'metric': 'cumulative-throughput', 'categories': 'foreach', 'types': 'foreach', 'graph': 'yes' }], 'format': 'xlsx', 'counts_towards_throughput': [], 'location': self.workspace, 'types': { 'failure': ['Bug', 'Fault'], 'value': ['New Feature', 'Story', 'Improvement'], 'oo': ['Task', 'Decision', 'User Support', 'Spike'] } } publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12))
def testOutputMultipleTypesOfThroughput(self): report_config = { 'name': 'reports', 'reports': [{ 'metric': 'throughput', 'categories': 'foreach', 'types': 'foreach' }], 'format': 'xlsx', 'location': self.workspace, 'counts_towards_throughput': [], 'categories': { 'one': 'project = "one"', 'two': 'project = "two"', 'three': 'project = "three"' }, 'types': { 'failure': ['Bug', 'Fault'], 'value': ['New Feature', 'Story', 'Improvement'], 'oo': ['Task', 'Decision', 'User Support', 'Spike'] } } publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue( os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format( spreadsheet=actual_output)) workbook = xlrd.open_workbook(actual_output) expected_sheet_name = 'throughput' self.assertEqual(expected_sheet_name, workbook.sheet_names()[0]) worksheet = workbook.sheet_by_name(expected_sheet_name) header_row = worksheet.row(0) expected_headers = ['one', 'two', 'three'] for cell in header_row[1:]: self.assertEqual(cell.value, expected_headers[header_row[1:].index(cell)])
def testOutputThroughputToExcel(self): # Given this report config: report_config = { 'name': 'reports', 'reports': [{ 'metric': 'throughput', 'categories': 'foreach', 'types': 'foreach' }], 'format': 'xlsx', 'location': self.workspace, 'counts_towards_throughput': [], 'types': { 'failure': ['Bug', 'Fault'], 'value': ['New Feature', 'Story', 'Improvement'], 'oo': ['Task', 'Decision', 'User Support', 'Spike'] } } # Specify categories and types to report on or: # foreach - to report on each category separately # combine - to aggregate totals together # when we publish the metrics for the data in our jira publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) # Then we should get an Excel workbook expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue( os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format( spreadsheet=actual_output)) # with a sheet containing the throughput data workbook = xlrd.open_workbook(actual_output) self.assertEqual('throughput', workbook.sheet_names()[0])
def testOutputDetailToExcel(self): report_config = { 'name': 'reports', 'reports': [{ 'metric': 'detail', 'fields': ['this', 'that', 'the other'], 'categories': 'foreach', 'types': 'foreach', 'sort': 'week-done' }], 'format': 'xlsx', 'counts_towards_throughput': [], 'location': self.workspace, 'types': { 'failure': ['Bug', 'Fault'], 'value': ['New Feature', 'Story', 'Improvement'], 'oo': ['Task', 'Decision', 'User Support', 'Spike'] } } publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue( os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format( spreadsheet=actual_output)) # with a sheet containing the throughput data workbook = xlrd.open_workbook(actual_output) self.assertEqual('detail', workbook.sheet_names()[0]) sheet = workbook.sheet_by_name('detail') fields = report_config['reports'][0]['fields'] for i in range(len(fields)): self.assertEqual(sheet.cell_value(0, i + 1), fields[i])
def testCumulativeThroughputGraph(self): report_config = {'name': 'reports', 'reports': [{'metric': 'cumulative-throughput', 'categories': 'foreach', 'types': 'foreach', 'graph': 'yes'}], 'format': 'xlsx', 'counts_towards_throughput': [], 'location': self.workspace, 'types': {'failure': ['Bug', 'Fault'], 'value': ['New Feature', 'Story', 'Improvement'], 'oo': ['Task', 'Decision', 'User Support', 'Spike']}} publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12))
def testAboutReport(self): """ Add a bit of blurb to the report """ report_config = { 'name': 'reports', 'reports': [{ 'metric': 'cumulative-throughput', 'description': 'All about flow', 'categories': 'foreach', 'types': 'foreach' }], 'format': 'xlsx', 'counts_towards_throughput': [], 'location': self.workspace, 'types': { 'failure': ['Bug', 'Fault'], 'value': ['New Feature', 'Story', 'Improvement'], 'oo': ['Task', 'Decision', 'User Support', 'Spike'] } } publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue( os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format( spreadsheet=actual_output)) workbook = xlrd.open_workbook(actual_output) expected_sheet_name = 'cumulative-throughput' self.assertEqual(expected_sheet_name, workbook.sheet_names()[0]) worksheet = workbook.sheet_by_name(expected_sheet_name) actual = worksheet.cell_value(rowx=0, colx=5) expected = report_config['reports'][0]['description'] self.assertEqual(actual, expected)
def testCfdDefaultColours(self): report_config = {'name': 'reports_default', 'states': ['open', 'in progress', 'closed'], 'reports': [{'metric': 'cfd'}], 'format': 'xlsx', 'location': self.workspace} publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports_default.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue(os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format(spreadsheet=actual_output)) self.compareExcelFiles(actual_output, expected_filename)
def testOutputFailureDemandToExcel(self): report_config = { 'name': 'reports', 'reports': [{ 'metric': 'demand', 'categories': 'foreach', 'types': ['failure'] }], 'format': 'xlsx', 'location': self.workspace, 'counts_towards_throughput': [], 'types': { 'failure': ['Bug', 'Fault'], 'value': ['New Feature', 'Story', 'Improvement'], 'oo': ['Task', 'Decision', 'User Support', 'Spike'] } } publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue( os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format( spreadsheet=actual_output)) # with a sheet containing the throughput data workbook = xlrd.open_workbook(actual_output) self.assertEqual('failure-demand', workbook.sheet_names()[0])
def testOutputCFDToExcel(self): report_config = {'name': 'reports', 'states': [], 'reports': [{'metric': 'cfd'}], 'format': 'xlsx', 'counts_towards_throughput': [], 'location': self.workspace} publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue(os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format(spreadsheet=actual_output)) # with a sheet containing the throughput data workbook = xlrd.open_workbook(actual_output) self.assertEqual('cfd', workbook.sheet_names()[0])
def testOutputThroughputToExcel(self): # Given this report config: report_config = {'name': 'reports', 'reports': [{'metric': 'throughput', 'categories': 'foreach', 'types': 'foreach'}], 'format': 'xlsx', 'location': self.workspace, 'counts_towards_throughput': [], 'types': {'failure': ['Bug', 'Fault'], 'value': ['New Feature', 'Story', 'Improvement'], 'oo': ['Task', 'Decision', 'User Support', 'Spike']}} # Specify categories and types to report on or: # foreach - to report on each category separately # combine - to aggregate totals together # when we publish the metrics for the data in our jira publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) # Then we should get an Excel workbook expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue(os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format(spreadsheet=actual_output)) # with a sheet containing the throughput data workbook = xlrd.open_workbook(actual_output) self.assertEqual('throughput', workbook.sheet_names()[0])
def testOutputDetailToExcel(self): report_config = {'name': 'reports', 'reports': [{'metric': 'detail', 'fields': ['this', 'that', 'the other'], 'categories': 'foreach', 'types': 'foreach', 'sort': 'week-done'}], 'format': 'xlsx', 'counts_towards_throughput': [], 'location': self.workspace, 'types': {'failure': ['Bug', 'Fault'], 'value': ['New Feature', 'Story', 'Improvement'], 'oo': ['Task', 'Decision', 'User Support', 'Spike']}} publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue(os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format(spreadsheet=actual_output)) # with a sheet containing the throughput data workbook = xlrd.open_workbook(actual_output) self.assertEqual('detail', workbook.sheet_names()[0]) sheet = workbook.sheet_by_name('detail') fields = report_config['reports'][0]['fields'] for i in range(len(fields)): self.assertEqual(sheet.cell_value(0, i+1), fields[i])
def testOutputCycleTimeToExcel(self): report_config = {'name': 'reports', 'reports': [{'metric': 'cycle-time', 'categories': 'foreach', 'types': ['value'], 'cycles': ['develop']}], 'format': 'xlsx', 'location': self.workspace} publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue(os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format(spreadsheet=actual_output)) # with a sheet containing the throughput data workbook = xlrd.open_workbook(actual_output) self.assertEqual('value-develop-cycle-time', workbook.sheet_names()[0])
def testOutputMultipleTypesOfThroughput(self): report_config = {'name': 'reports', 'reports': [{'metric': 'throughput', 'categories': 'foreach', 'types': 'foreach'}], 'format': 'xlsx', 'location': self.workspace, 'counts_towards_throughput': [], 'categories': {'one': 'project = "one"', 'two': 'project = "two"', 'three': 'project = "three"'}, 'types': {'failure': ['Bug', 'Fault'], 'value': ['New Feature', 'Story', 'Improvement'], 'oo': ['Task', 'Decision', 'User Support', 'Spike']}} publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue(os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format(spreadsheet=actual_output)) workbook = xlrd.open_workbook(actual_output) expected_sheet_name = 'throughput' self.assertEqual(expected_sheet_name, workbook.sheet_names()[0]) worksheet = workbook.sheet_by_name(expected_sheet_name) header_row = worksheet.row(0) expected_headers = ['one', 'two', 'three'] for cell in header_row[1:]: self.assertEqual(cell.value, expected_headers[header_row[1:].index(cell)])
def testOutputArrivalRateToExcel(self): report_config = {'name': 'reports', 'reports': [{'metric': 'arrival-rate'}], 'format': 'xlsx', 'location': self.workspace} publisher.publish(report_config, self.mock_metrics, from_date=date(2012, 10, 8), to_date=date(2012, 11, 12)) expected_filename = 'reports.xlsx' actual_output = os.path.join(self.workspace, expected_filename) self.assertTrue(os.path.isfile(actual_output), "Spreadsheet not published:{spreadsheet}".format(spreadsheet=actual_output)) workbook = xlrd.open_workbook(actual_output) expected_sheet_name = 'arrival-rate' self.assertEqual(expected_sheet_name, workbook.sheet_names()[0]) worksheet = workbook.sheet_by_name(expected_sheet_name) header_row = worksheet.row(0) expected_headers = ['one', 'two', 'three']