Esempio n. 1
0
 def setUp(self):
     super(ShowTestResultForTeamProjectAndTestTest, self).setUp()
     self.user = UserFactory.create(with_token=True)
     self.team = TeamFactory.create(owner=self.user)
     TeamFactory.add_projects(self.team, 2)
     self.project = self.team.projects[0]
     self.load_test = LoadTestFactory.create(created_by=self.user, team=self.team, project_name=self.project.name, status="Finished")
     self.load_test.save()
     self.config = TestConfigurationFactory.build()
     self.config2 = TestConfigurationFactory.build()
Esempio n. 2
0
 def setUp(self):
     super(ShowTestResultForTeamProjectAndTestTest, self).setUp()
     self.user = UserFactory.create(with_token=True)
     self.team = TeamFactory.create(owner=self.user)
     TeamFactory.add_projects(self.team, 2)
     self.project = self.team.projects[0]
     self.load_test = LoadTestFactory.create(created_by=self.user,
                                             team=self.team,
                                             project_name=self.project.name,
                                             status="Finished")
     self.load_test.save()
     self.config = TestConfigurationFactory.build()
     self.config2 = TestConfigurationFactory.build()
Esempio n. 3
0
 def _add_results_for_last(self):
     config = TestConfigurationFactory.build()
     self.load_test.results.append(TestResultFactory.build(config=config))
     self.load_test.results.append(TestResultFactory.build())
     self.load_test.save()
     self.load_test2 = LoadTestFactory.add_to_project(1, user=self.user, team=self.team, project=self.project, status="Finished")
     self.load_test2.results.append(TestResultFactory.build())
     self.load_test2.results.append(TestResultFactory.build(config=config))
     self.load_test2.save()
Esempio n. 4
0
 def _add_results_for_last(self):
     config = TestConfigurationFactory.build()
     self.load_test.results.append(TestResultFactory.build(config=config))
     self.load_test.results.append(TestResultFactory.build())
     self.load_test.save()
     self.load_test2 = LoadTestFactory.add_to_project(1,
                                                      user=self.user,
                                                      team=self.team,
                                                      project=self.project,
                                                      status="Finished")
     self.load_test2.results.append(TestResultFactory.build())
     self.load_test2.results.append(TestResultFactory.build(config=config))
     self.load_test2.save()
Esempio n. 5
0
    def test_get_last_result_for_diff(self):
        config = TestConfigurationFactory.build()
        self.load_test.results.append(TestResultFactory.build(config=config))
        self.load_test.results.append(TestResultFactory.build())
        self.load_test.save()
        load_test2 = LoadTestFactory.add_to_project(1, user=self.user, team=self.team, project=self.project, status="Finished")
        load_test2.results.append(TestResultFactory.build())
        load_test2.results.append(TestResultFactory.build(config=config))
        load_test2.save()

        result1 = self.load_test.results[0]
        result2 = load_test2.results[1]

        test_result = LoadTest.get_last_result_for(str(result2.uuid))
        expect(str(test_result.uuid)).to_equal(str(result1.uuid))
Esempio n. 6
0
def main(args=None):
    if args is None:
        args = sys.argv[1:]

    parser = argparse.ArgumentParser()
    parser.add_argument('--conf', '-c', default=DEFAULT_CONFIG_PATH, help="Path to configuration file.")
    options = parser.parse_args(args)

    config = Config.load(path=options.conf, conf_name=split(options.conf)[-1], lookup_paths=[
        os.curdir,
        expanduser('~'),
        '/etc/',
    ])

    connect(
        config.MONGO_DB,
        host=config.MONGO_HOST,
        port=config.MONGO_PORT,
        username=config.MONGO_USER,
        password=config.MONGO_PASS
    )

    user = UserFactory.create()
    team = TeamFactory.create(owner=user)
    TeamFactory.add_projects(team, 1)
    project = team.projects[0]
    config = TestConfigurationFactory.build()
    load_test1 = LoadTestFactory.add_to_project(1, user=user, team=team, project=project)
    load_test1.results.append(TestResultFactory.build(config=config))
    load_test1.save()
    print "load test 1: %s" % load_test1.uuid
    print "test result for load test 1: %s" % load_test1.results[0].uuid
    load_test2 = LoadTestFactory.add_to_project(1, user=user, team=team, project=project)
    load_test2.results.append(TestResultFactory.build(config=config))
    load_test2.results.append(TestResultFactory.build())
    load_test2.save()
    load_test3 = LoadTestFactory.add_to_project(1, user=user, team=team, project=project)
    load_test3.results.append(TestResultFactory.build(config=config))
    load_test3.save()
    load_test4 = LoadTestFactory.add_to_project(1, user=user, team=team, project=project)
    load_test4.results.append(TestResultFactory.build(config=config))
    load_test4.save()
    print "load test 2: %s" % load_test2.uuid
    print "test result 1 for load test 2: %s" % load_test2.results[0].uuid
    print "test result 2 for load test 2: %s" % load_test2.results[1].uuid
    print "url for trend: %s/%s/%s/%s/%s/" % (team.name, project.name, config.module, config.class_name, config.test_name)
Esempio n. 7
0
    def test_get_results_for_team_project_and_test_get_finished_only(self):
        config = TestConfigurationFactory.build()
        self.load_test.results.append(TestResultFactory.build(config=config))
        self.load_test.results.append(TestResultFactory.build())
        self.load_test.results.append(TestResultFactory.build(config=config))
        self.load_test.save()
        load_test2 = LoadTestFactory.add_to_project(1, user=self.user, team=self.team, project=self.project, status="Failed")
        load_test2.results.append(TestResultFactory.build())
        load_test2.results.append(TestResultFactory.build(config=config))
        load_test2.save()
        load_test3 = LoadTestFactory.add_to_project(1, user=self.user, team=self.team, project=self.project)
        load_test3.results.append(TestResultFactory.build())
        load_test3.results.append(TestResultFactory.build(config=config))
        load_test3.save()

        results = [str(result.uuid) for result in LoadTest.get_same_results_for_all_load_tests_from_project(self.team, self.project.name, config.module, config.class_name, config.test_name)]

        expected_results = [
            str(self.load_test.results[0].uuid),
            str(self.load_test.results[2].uuid),
        ]

        expect(results).to_be_like(expected_results)