Checked code:
public class TestReader { public string Content { get; private set; } public void LoadFile(string fileName) { var content = FileSystem.ReadAllText(fileName); if (!content.StartsWith("test")) throw new ArgumentException("invalid file"); this.Content = content; } } public static class FileSystem { public static string ReadAllText(string fileName) { return File.ReadAllText(fileName); } }
Pex method in test project:
[PexMethod] public void CheckValidFileWithPex(string content) {
When I first run Pex Explorations on CheckValidFileWithPex(string content) , five test methods are generated with the following values ββfor content :
- Null
- ""
- "\ 0 \ 0 \ 0 \ 0"
- "test"
- "\ 0 \ 0 \ 0 \ 0 \ 0"
However, if I ran Pex Explorations again, there were no changes made to the generated tests, the existing code of the test project or the main project before the second run, then only 4 tests are listed as generated, and the test input is 3 ("\ 0 \ 0 \ 0 \ 0 ") is missing.
The source code for the test file created by Pex still has a verification method for this case, but I donβt understand why this case is not listed in the results of the Pex study.
Thank you for your understanding.
source share