示例#1
0
 def test_distributor_properties(self):
     versiondistributor = Distributor(self.data,
                                      strategy=VersionDistributor)
     self.assertEqual(versiondistributor.data, self.data)
     testdistributor = Distributor(self.data, strategy=TestDistributor)
     self.assertEqual(testdistributor.data, self.data)
     unidistributor = Distributor(self.data,
                                  strategy=RandomVersionDistributor)
     self.assertEqual(unidistributor.data, self.data)
示例#2
0
 def test_get_suite_1inst(self):
     self.data['total'] = 1
     self.data[
         'project'] = "/home/selin/Documents/Uni/Bachelorthesis/project"
     distributor = Distributor(self.data, strategy=TestDistributor)
     test_result = distributor.get_suite()
     self.assertEquals(len(test_result), 1)
     self.assertEquals(len(test_result[0]), 2)
     self.assertEquals(len(test_result[0][0]), 1)
     self.assertItemsEqual(test_result[0][1], self.benchmarks)
示例#3
0
 def test_get_suite_1inst(self):
     self.data['total'] = 1
     distributor = Distributor(self.data, strategy=VersionDistributor)
     test_result = distributor.get_suite()
     self.assertEquals(len(test_result), 1)
     self.assertEquals(len(test_result[0]), 2)
     self.assertItemsEqual(test_result, [[self.versions, [None]]])
     self.assertEquals(len(test_result[0][1]), 1)
     self.assertEquals(test_result[0][1][0], None)
     self.assertEqual(test_result[0][0], self.versions)
     self.assertEqual(test_result[0][0][0], self.versions[0])
示例#4
0
 def test_get_suite_50insts(self):
     self.data['total'] = 50
     distributor = Distributor(self.data, strategy=RandomVersionDistributor)
     test_result = distributor.get_suite()
     for x in range(0, 50):
         self.assertEquals(test_result[x][1][0], None)
     self.assertEquals(test_result.content, 'random')
     expected = []
     [expected.append([[item], [None]]) for item in self.versions]
     [expected.append([[None], [None]]) for i in range(9)]
     self.assertItemsEqual(test_result, expected)
     self.assertEquals(len(test_result), 50)
示例#5
0
 def test_random_version_distributor_1inst(self):
     self.data['total'] = 1
     distributor = Distributor(self.data, strategy=RandomVersionDistributor)
     test_result = distributor.get_suite()
     self.assertEquals(test_result.content, 'random')
     self.assertEquals(len(test_result), 1)
     self.assertEquals(len(test_result[0]), 2)
     self.assertEquals(len(test_result[0][1]), 1)
     self.assertEquals(test_result[0][1][0], None)
     for item in test_result[0][0]:
         self.assertIn(item, self.versions)
     self.assertNotEqual(test_result[0][0][0], self.versions[0])
示例#6
0
 def test_get_suite_18insts(self):
     self.data['total'] = 18
     self.data[
         'project'] = "/home/selin/Documents/Uni/Bachelorthesis/project"
     distributor = Distributor(self.data, strategy=TestDistributor)
     test_result = distributor.get_suite()
     for x in range(0, 18):
         self.assertEquals(test_result[x][0][0], None)
     expected = []
     [expected.append([[None], [item]]) for item in self.benchmarks]
     [expected.append([[None], [None]]) for i in range(2)]
     self.assertItemsEqual(test_result, expected)
     self.assertEquals(len(test_result), 18)
示例#7
0
 def test_get_suite_3insts(self):
     self.data['total'] = 3
     distributor = Distributor(self.data, strategy=VersionDistributor)
     test_result = distributor.get_suite()
     num_items = len(test_result[0][0]) + len(test_result[1][0]) + len(
         test_result[2][0])
     self.assertEquals(num_items, len(self.versions))
     self.assertEquals(test_result[0][1][0], None)
     self.assertEquals(test_result[1][1][0], None)
     self.assertEquals(test_result[2][1][0], None)
     self.assertItemsEqual(
         test_result,
         [[self.versions[:2], [None]], [self.versions[2:4], [None]],
          [self.versions[4:], [None]]])
示例#8
0
 def test_get_suite_3insts(self):
     self.data['total'] = 3
     distributor = Distributor(self.data, strategy=RandomVersionDistributor)
     test_result = distributor.get_suite()
     self.assertEquals(test_result.content, 'random')
     num_items = len(test_result[0][0]) + len(test_result[1][0]) + len(
         test_result[2][0])
     self.assertEquals(num_items, len(self.versions))
     self.assertEquals(test_result[0][1][0], None)
     self.assertEquals(test_result[1][1][0], None)
     self.assertEquals(test_result[2][1][0], None)
     self.assertNotEquals(
         test_result,
         [[self.versions[:13], [None]], [self.versions[13:26], [None]],
          [self.versions[26:], [None]]])
示例#9
0
 def test_get_suite_3inst(self):
     self.data['total'] = 3
     self.data[
         'project'] = "/home/selin/Documents/Uni/Bachelorthesis/project"
     distributor = Distributor(self.data, strategy=TestDistributor)
     test_result = distributor.get_suite()
     num_items = len(test_result[0][1]) + len(test_result[1][1]) + len(
         test_result[2][1])
     self.assertEquals(num_items, len(self.benchmarks))
     self.assertEquals(test_result[0][0][0], None)
     self.assertEquals(test_result[1][0][0], None)
     self.assertEquals(test_result[2][0][0], None)
     for item in test_result[0][1]:
         self.assertIn(item, self.benchmarks)
     for item in test_result[1][1]:
         self.assertIn(item, self.benchmarks)
     for item in test_result[2][1]:
         self.assertIn(item, self.benchmarks)
示例#10
0
 def test_get_suite_5insts(self):
     self.data['total'] = 5
     distributor = Distributor(self.data, strategy=RandomVersionDistributor)
     test_result = distributor.get_suite()
     num_items = len(test_result[0][0]) + len(test_result[1][0]) + len(
         test_result[2][0]) + len(test_result[3][0]) + len(
             test_result[4][0])
     self.assertEquals(num_items, len(self.versions))
     self.assertEquals(test_result[0][1][0], None)
     self.assertEquals(test_result[1][1][0], None)
     self.assertEquals(test_result[2][1][0], None)
     self.assertEquals(test_result[3][1][0], None)
     self.assertEquals(test_result[4][1][0], None)
     self.assertEquals(test_result.content, 'random')
     self.assertNotEquals(
         test_result,
         [[self.versions[:8], [None]], [self.versions[8:16], [None]],
          [self.versions[16:24], [None]], [self.versions[24:32], [None]],
          [self.versions[32:], [None]]])
     self.assertEquals(len(test_result), 5)
示例#11
0
 def test_get_suite_5insts(self):
     self.data['total'] = 5
     distributor = Distributor(self.data, strategy=VersionDistributor)
     test_result = distributor.get_suite()
     num_items = len(test_result[0][0]) + len(test_result[1][0]) + len(
         test_result[2][0]) + len(test_result[3][0]) + len(
             test_result[4][0])
     self.assertEquals(num_items, len(self.versions))
     self.assertEquals(test_result[0][1][0], None)
     self.assertEquals(test_result[1][1][0], None)
     self.assertEquals(test_result[2][1][0], None)
     self.assertEquals(test_result[3][1][0], None)
     self.assertEquals(test_result[4][1][0], None)
     self.assertNotEqual(test_result.content, 'random')
     self.assertItemsEqual(
         test_result,
         [[self.versions[:9], [None]], [self.versions[9:17], [None]],
          [self.versions[17:25], [None]], [self.versions[25:33], [None]],
          [self.versions[33:], [None]]])
     self.assertEquals(len(test_result), 5)
示例#12
0
 def test_get_suite_5inst(self):
     self.data['total'] = 5
     self.data[
         'project'] = "/home/selin/Documents/Uni/Bachelorthesis/project"
     distributor = Distributor(self.data, strategy=TestDistributor)
     test_result = distributor.get_suite()
     for item in test_result[0][1]:
         self.assertIn(item, self.benchmarks)
     for item in test_result[1][1]:
         self.assertIn(item, self.benchmarks)
     for item in test_result[2][1]:
         self.assertIn(item, self.benchmarks)
     for item in test_result[3][1]:
         self.assertIn(item, self.benchmarks)
     for item in test_result[4][1]:
         self.assertIn(item, self.benchmarks)
     self.assertEquals(len(test_result), 5)
     self.assertEquals(test_result[0][0][0], None)
     self.assertEquals(test_result[1][0][0], None)
     self.assertEquals(test_result[2][0][0], None)
     self.assertEquals(test_result[3][0][0], None)
     self.assertEquals(test_result[4][0][0], None)
     self.assertGreater(len(test_result[0][1]), len(test_result[4][1]))
示例#13
0
 def test_get_suite(self):
     self.data['total'] = 7
     self.data['CL-params']['--tests'] = "'abc$|xyz$'"
     rmit = Distributor(self.data, strategy=RMIT)
     tests = rmit.get_suite()
     print tests