Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added debug message section. #610

Closed
wants to merge 4 commits into from

Conversation

siad007
Copy link
Contributor

@siad007 siad007 commented Jan 13, 2019

This PR:

Fixes #520

@maks-rafalko maks-rafalko self-requested a review January 13, 2019 11:02
@@ -68,6 +68,18 @@ protected function getLogLines(): array
'Not Covered'
);

if (!empty($this->metricsCalculator->getDebugInfo())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File DebugFileLogger is used for end-to-end tests only. It's not supposed to be used for developers.
We have recently removed it from the documentation, but it hasn't been released yet.

I've added a comment to this class that it's for e2e tests only.

/**
* @var string[]
*/
private $debugMessage = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure MetricsCalculator should have debugMessage array, this looks a bit confusing.

Since the writing to log files is done through subscribers (see MutationTestingResultsLoggerSubscriber), I would suggest the following:

  1. Add a initial tests run process to the InitialTestSuiteStarted() event's constructor here:

$this->eventDispatcher->dispatch(new InitialTestSuiteStarted());

  1. Subscribe to this InitialTestSuiteStarted event in MutationTestingResultsLoggerSubscriber here

public function getSubscribedEvents(): array
{
return [
MutationTestingFinished::class => [$this, 'onMutationTestingFinished'],
];
}

  1. Extract the process (or command line string) from the InitialTestSuiteStarted event and use it in MutationTestingResultsLoggerSubscriber::onMutationTestingFinished() (which is executed later than InitialTestSuiteStarted)

Copy link
Member

@maks-rafalko maks-rafalko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be convenient to add this debug info to infection.log when --debug option is used

Also, the command line should be logged only when --debug option is used, since we are trying to reduce the number of generated information from the log files by default.

@BackEndTea
Copy link
Member

Instead of adding it to the infection.log, why not output it to the terminal (when using --debug of course)?

@maks-rafalko
Copy link
Member

maks-rafalko commented Jan 17, 2019

  • We didn't output anything for debugging purposes before to the terminal
  • Mutation command lines are logged to the infection.log, so adding initial tests run command line there seemed to me consistent.

However, I'm ok with adding it to stdout.

@BackEndTea BackEndTea mentioned this pull request Apr 25, 2019
2 tasks
@maks-rafalko
Copy link
Member

maks-rafalko commented Apr 27, 2019

Closing in favor of #683. Thanks @siad007 for your efforts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log the InitialTestsRun command line when --debug is used
3 participants