@@ -17,6 +17,8 @@ public class CoverageCollector : InProcDataCollection
17
17
private IDataCollectionSink _dataSink ;
18
18
private bool _coverageOn ;
19
19
private int _activeMutation = - 1 ;
20
+ private bool _reportFailure ;
21
+
20
22
private Action < string > _logger ;
21
23
private readonly IDictionary < string , int > _mutantTestedBy = new Dictionary < string , int > ( ) ;
22
24
@@ -34,6 +36,7 @@ public class CoverageCollector : InProcDataCollection
34
36
35
37
public const string PropertyName = "Stryker.Coverage" ;
36
38
public const string OutOfTestsPropertyName = "Stryker.Coverage.OutOfTests" ;
39
+ public const string Coveragelog = "CoverageLog" ;
37
40
38
41
public string MutantList => string . Join ( "," , _mutantTestedBy . Values . Distinct ( ) ) ;
39
42
@@ -168,12 +171,12 @@ private void ReadConfiguration(string configuration)
168
171
169
172
private int GetActiveMutantForThisTest ( string testId )
170
173
{
171
- if ( _mutantTestedBy . ContainsKey ( testId ) )
174
+ if ( _mutantTestedBy . TryGetValue ( testId , out var test ) )
172
175
{
173
- return _mutantTestedBy [ testId ] ;
176
+ return test ;
174
177
}
175
178
176
- return _mutantTestedBy . ContainsKey ( AnyId ) ? _mutantTestedBy [ AnyId ] : - 1 ;
179
+ return _mutantTestedBy . TryGetValue ( AnyId , out var value ) ? value : - 1 ;
177
180
}
178
181
179
182
private void ParseTestMapping ( XmlNodeList testMapping )
@@ -240,6 +243,11 @@ private void PublishCoverageData(DataCollectionContext dataCollectionContext)
240
243
{
241
244
// no test covered any mutations, so the controller was never properly initialized
242
245
_dataSink . SendData ( dataCollectionContext , PropertyName , ";" ) ;
246
+ if ( ! _reportFailure )
247
+ {
248
+ _dataSink . SendData ( dataCollectionContext , Coveragelog , $ "Did not find type { _controlClassName } . This indicates Stryker failed to copy the mutated assembly for test.") ;
249
+ _reportFailure = true ;
250
+ }
243
251
return ;
244
252
}
245
253
0 commit comments