def test_value(self, issue_with_field_mock): """ Test that the value of the metric is the duration of the manual logical test cases. """ jira_filter = metric_source.JiraFilter('http://jira/', 'username', 'password') issue_with_field_mock.return_value = [("issue1", 20), ("issue2", 60), ("issue3", 40)] self.__project = domain.Project(metric_sources={metric_source.ManualLogicalTestCaseTracker: jira_filter}, metric_source_ids={jira_filter: '12345'}) self.__metric = metric.DurationOfManualLogicalTestCases(subject=self.__project, project=self.__project) issue_with_field_mock.asses_called_once() self.assertEqual(120, self.__metric.value())
""" Project definition for testing a project with all requirements and sources, but no source ids. """ from hqlib import metric_source, requirement from hqlib.domain import Project, Product, Application, Component, Team, Document, Environment, Process # Sources HISTORY = metric_source.History('tests/integrationtests/test_no_source_ids/history.json') GIT = metric_source.Git(url='http://git/repo') SONAR = metric_source.Sonar('http://sonar/') BUG_TRACKER = metric_source.JiraFilter(url='http://jira/', username='******', password='******') WEKAN = metric_source.WekanBoard('http://wekan', username='******', password='******') # The project PROJECT = Project( 'Integrationtest', name='all requirements and sources, but no source ids', metric_sources={ metric_source.History: HISTORY, metric_source.VersionControlSystem: GIT, metric_source.BugTracker: BUG_TRACKER, metric_source.ActionLog: WEKAN, metric_source.UnitTestReport: SONAR, metric_source.Sonar: SONAR}, added_requirements=Project.optional_requirements()) # Documents. DOC = Document(name='Document XYZ', added_requirements=Document.optional_requirements()) PROJECT.add_document(DOC) # Teams of the project. TEAM = Team(name='Team 123', short_name='TE', added_requirements=Team.optional_requirements()) PROJECT.add_team(TEAM)
BUILD_SERVER = metric_source.Jenkins('http://jenkins/', username='******', password='******', job_re='-metrics') JENKINS = metric_source.Jenkins(url='http://www.jenkins.proj.org:8080/') SONAR = metric_source.Sonar('https://my.sonarqube.com/') JUNIT = metric_source.JunitTestReport() HISTORY = metric_source.CompactHistory(PROJECT_DIR / 'docs' / 'examples' / 'quality_report' / 'history.json') JACOCO = metric_source.JaCoCo() ZAP_SCAN_REPORT = metric_source.ZAPScanReport() SECURITY_REPORT_PROXY = metric_source.FileWithDate() USER_STORIES_IN_PROGRESS_TRACKER = \ metric_source.JiraFilter('https://jira.myorg.nl/jira', username="******", password="******") USER_STORIES_DURATION_TRACKER = \ metric_source.JiraFilter('https://jira.myorg.nl/jira', username="******", password="******") DURATION_MANUAL_TEST_CASES = \ metric_source.JiraFilter('https://jira.myorg.nl/jira', username="******", password="******", field_name="customfield_11700") TRELLO_BOARD = metric_source.TrelloBoard(appkey='2d3', token='57b') # The project PROJECT = Project( 'Organization name', name='Quality Report', metric_sources={ metric_source.Jenkins: BUILD_SERVER,