微软白盒测试例子pex.samples

时间:2012-04-24 10:01:04
【文件属性】:

文件名称:微软白盒测试例子pex.samples

文件大小:151KB

文件格式:ZIP

更新时间:2012-04-24 10:01:04

pex white box test

Programs that interact with the file system are a classical challenge to the testable software. Using directly file system primitives such as the System.IO.File class makes the code less testable since it hardcodes a dependency on the state of the physical file system at the time tests are executed. A classic symptomatic example are test case that pass the first time they are run, then fail on subsequent run. The first run generated files which breaks subsequent runs. To deal with these issues, programmers usually introduce a level of abstraction between the environment, i.e. the file system, and the code. In this sample, we took an abstraction of the file system that was defined in the CodePex Client project [1]. Unfortunately, even with a clear abstraction layer, the burden of the developer is still high. He has to understand the subtleties file system to craft a meaningful set of test cases. The file system is a complex system, whose complexity is underrated, which lead programmers to overlook obscure possible corner cases. To address this, we will show how Pex can be used to define a parameterized model of the file system, PFileSystem. The sample will show how to implement a CopyFiles method that copies the files from one directory to another.


网友评论