Exemple #1
0
def test_variables_generator():
    tracker = StatisticsTracker()
    value_1 = MagicMock(Timer)
    value_2 = MagicMock(Timer)
    tracker.track_output_variable(RuntimeVariable.TotalTime, value_1)
    tracker.track_output_variable(RuntimeVariable.TotalTime, value_2)
    result = [v for _, v in tracker.variables_generator]
    assert result == [value_1, value_2]
 def send_statistics(self):
     super().send_statistics()
     tracker = StatisticsTracker()
     tracker.track_output_variable(RuntimeVariable.MonkeyTypeExecutions,
                                   self._monkey_type_executions)
     tracker.track_output_variable(
         RuntimeVariable.ParameterTypeUpdates,
         [self._special_chars(str(p)) for p in self._parameter_updates],
     )
     tracker.track_output_variable(RuntimeVariable.ParameterTypeUpdatesSize,
                                   len(self._parameter_updates))
     tracker.track_output_variable(
         RuntimeVariable.ReturnTypeUpdates,
         [self._special_chars(str(r)) for r in self._return_type_updates],
     )
     tracker.track_output_variable(RuntimeVariable.ReturnTypeUpdatesSize,
                                   len(self._return_type_updates))
Exemple #3
0
 def _collect_statistics() -> None:
     tracker = StatisticsTracker()
     tracker.track_output_variable(RuntimeVariable.TargetModule,
                                   config.INSTANCE.module_name)
     tracker.track_output_variable(RuntimeVariable.RandomSeed,
                                   randomness.RNG.get_seed())
     tracker.track_output_variable(RuntimeVariable.ConfigurationId,
                                   config.INSTANCE.configuration_id)
     for runtime_variable, value in tracker.variables_generator:
         tracker.set_output_variable_for_runtime_variable(
             runtime_variable, value)
 def _track_sut_data(tracer: ExecutionTracer, test_cluster: TestCluster) -> None:
     """Track data from the SUT."""
     tracker = StatisticsTracker()
     tracker.track_output_variable(
         RuntimeVariable.CodeObjects,
         len(tracer.get_known_data().existing_code_objects),
     )
     tracker.track_output_variable(
         RuntimeVariable.Predicates, len(tracer.get_known_data().existing_predicates)
     )
     tracker.track_output_variable(
         RuntimeVariable.AccessibleObjectsUnderTest,
         test_cluster.num_accessible_objects_under_test(),
     )
Exemple #5
0
 def _track_statistics(
     non_failing: tsc.TestSuiteChromosome,
     failing: tsc.TestSuiteChromosome,
     combined: tsc.TestSuiteChromosome,
 ) -> None:
     tracker = StatisticsTracker()
     tracker.current_individual(combined)
     tracker.track_output_variable(RuntimeVariable.Size, combined.size())
     tracker.track_output_variable(
         RuntimeVariable.Length, combined.total_length_of_test_cases
     )
     tracker.track_output_variable(RuntimeVariable.FailingSize, failing.size())
     tracker.track_output_variable(
         RuntimeVariable.FailingLength, failing.total_length_of_test_cases,
     )
     tracker.track_output_variable(RuntimeVariable.PassingSize, non_failing.size())
     tracker.track_output_variable(
         RuntimeVariable.PassingLength, non_failing.total_length_of_test_cases
     )
Exemple #6
0
 def send_statistics(self) -> None:
     super().send_statistics()
     tracker = StatisticsTracker()
     tracker.track_output_variable(RuntimeVariable.ExecutionResults,
                                   self._execution_results)
Exemple #7
0
def test_tracker():
    tracker = StatisticsTracker()
    value = MagicMock(Timer)
    tracker.track_output_variable(RuntimeVariable.TotalTime, value)
    assert tracker.variables.get() == (RuntimeVariable.TotalTime, value)