有哪些工具可用于灵活代码覆盖?

时间:2010-06-28 16:00:56

标签: flex actionscript code-coverage flexcover

我一直试图让Flex Cover正常工作一段时间,但我们遇到的问题是它只为当前被我们的单元测试命中的类提供代码覆盖。

我们如何获得flex cover以为我们的整个源目录提供正确的检测?

我尝试了几种不同的编译器参数来包含所有没有运气的类。

同样让flex cover胖客户端在CI环境中工作从未实现过,所以我们只需手动运行Flex Cover。

此时我并不觉得柔性罩足够成熟,可以可靠地使用。

我们应该尝试使用其他工具来获得正确的flex代码覆盖率吗?

4 个答案:

答案 0 :(得分:1)

下一个FlexMojos(版本4)将包括Flex测试覆盖率。

在此处阅读更多内容:http://www.sonatype.com/people/2010/04/flex-test-coverage-kept-simple-with-flexmojos/

答案 1 :(得分:0)

FlexMojos不太稳定,加上我们因各种原因无法升级到Maven 3。我们最终只是将类编译为包含。以下是一个例子。

< fileset id =“test.src.loc.fileset”dir =“$ {test.src.loc}”>
< include name =“ /Test*.as”/>
< include name =“
/ * TestCase.as”/>
< /文件集>

< path id =“test.src.loc.path”>
< pathelement location =“$ {test.src.loc}”/>
< /路径>

< property name =“test.src.loc.path”refid =“test.src.loc.path”/>

< pathconvert pathsep =“; import”property =“test.runner.imports”refid =“test.src.loc.fileset”>
< chainedmapper>
< globmapper from =“$ {test.src.loc.path} \”to =“”/>

< packagemapper from =“ .as”to =“”/>
< / chainedmapper>
< / pathconvert>

< pathconvert pathsep =“,”property =“test.runner.calls”refid =“test.src.loc.fileset”> < chainedmapper>
< globmapper from =“$ {test.src.loc.path} \”to =“”/>

< packagemapper from =“ .as”to =“”/>
< / chainedmapper>
< / pathconvert>

< copy tofile =“$ {test.runner}”file =“$ {test.runner.template}”overwrite =“true”/>

< replace file =“$ {test.runner}”token =“#IMPORTS#”value =“$ {test.runner.imports}”/> < replace file =“$ {test.runner}”token =“#CALLS#”value =“$ {test.runner.calls}”/>

< fileset id =“main.src.loc.fileset”dir =“$ {main.src.loc}”>
< include name =“com / classes / / *。as”/>
< exclude name =“com / other / classes /
”/>
< /文件集>

< path id =“main.src.loc.path”>
< pathelement location =“$ {main.src.loc}”/>
< /路径>

< property name =“main.src.loc.path”refid =“main.src.loc.path”/>

< pathconvert pathsep =“”property =“main.src.loc.classes”refid =“main.src.loc.fileset”>
< chainedmapper>
< globmapper from =“$ {main.src.loc.path} \”to =“”/>

< packagemapper from =“ .as”to =“”/>
< / chainedmapper>
< / pathconvert>

< fileset id =“library.path”dir =“$ {basedir}”>
< include name =“$ {flexcover.framework.loc} / frameworks / libs / .swc”/>

< include name =“$ {flexcover.framework.loc} / frameworks / locale / en_US /
.swc”/>

< include name =“$ {unit.test.lib.loc} / .swc”/>

< include name =“$ {lib.loc} /
.swc”/>
< /文件集>

< pathconvert pathsep =“”property =“library.path”refid =“library.path”/>

< exec executable =“$ {mxmlc.exe}”dir =“$ {main.src.loc}”>
< arg line =“$ {test.runner}”/>
< arg line =“ - 输出$ {test.finalName}”/>
< arg line =“ - source-path $ {main.src.loc} $ {test.src.loc} $ {main.src.loc} /../ locale / en_US $ {test.src.loc} / ../resources“/>
< arg line =“ - library-path $ {library.path}”/>
< arg line =“ - locale en_US”/>
< arg line =“ - 包括$ {main.src.loc.classes}”/>
< arg line =“ - verbose-stacktraces = true”/>
< / EXEC>

答案 2 :(得分:0)

Adob​​e为Flash Builder提供了自己的代码覆盖率插件:http://www.adobe.com/devnet/flash-builder/articles/ascode-coverage.html

答案 3 :(得分:0)

您可以使用Flash Builder的ActionScript代码覆盖率插件。只需在此处查看记录良好的内容:AS Code Coverage

希望它有帮助:) -S