-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance Improvement - Perform test filtering earlier in process (#…
…433) * Add test to run one out of 10000 specs * Prevent multiple enumeration of Contexts * Move filtering to before Context is created * Simplify FindContexts to use same pattern as FindContextsIn * Use IEnumerable extension method * Display compile diagnostic when compilation fails * Make parameter optional * Extend test to track instantiations * Update src/Machine.Specifications/Utility/KeyValuePairExtensions.cs Co-authored-by: Robert Coltheart <[email protected]> * Update src/Machine.Specifications/Explorers/AssemblyExplorer.cs Co-authored-by: Robert Coltheart <[email protected]> * Update src/Machine.Specifications/Explorers/AssemblyExplorer.cs Co-authored-by: Robert Coltheart <[email protected]> Co-authored-by: Robert Coltheart <[email protected]>
- Loading branch information
1 parent
c4eb55a
commit 7c910d6
Showing
8 changed files
with
235 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System.Text; | ||
|
||
namespace Machine.Specifications.Specs.Fixtures | ||
{ | ||
public class LargeFixture | ||
{ | ||
public static string CreateCode(int specCount) | ||
{ | ||
var sb = new StringBuilder(); | ||
|
||
sb.AppendLine(@" | ||
using System; | ||
using System.Diagnostics; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
using Machine.Specifications; | ||
namespace Example.Large | ||
{ | ||
public class when_there_are_many_contexts | ||
{ | ||
public static bool Created = false; | ||
public when_there_are_many_contexts() | ||
{ | ||
Created = true; | ||
} | ||
It spec = () => {}; | ||
} | ||
public static class OtherTests | ||
{ | ||
public static bool Created = false; | ||
} | ||
"); | ||
|
||
for (var i = 1; i <= specCount; i++) | ||
{ | ||
sb.AppendLine($@" | ||
public class when_there_are_many_contexts_{i} | ||
{{ | ||
public when_there_are_many_contexts_{i}() | ||
{{ | ||
OtherTests.Created = true; | ||
}} | ||
It spec = () => {{}}; | ||
}}"); | ||
} | ||
|
||
sb.AppendLine(@" | ||
}"); | ||
|
||
return sb.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.