我试图让所有文件名通过某个过滤器进入一个由空格分隔的单个变量。
这有效:
<foreach item="File" property="filename">
<in>
<items>
<include name="bin\*Test.dll" />
<include name="bin\*Tests.dll" />
</items>
</in>
<do>
<echo>Executing serverSideTests</echo>
<tstamp />
<exec basedir="${devenv.dir}" program="VSTest.Console.exe" commandline='"${filename}" /TestCaseFilter:"TestCategory!=Debugging|TestCategory!=Upgrade"' failonerror="true" />
<tstamp />
</do>
</foreach>
我想运行这个:
VSTest.Console.exe file1 file2 ...
为什么我要这样做,结合上面的内容,我将使用runsettings来并行化上面不同的测试集。
如何将文件名连接成单个空格分隔的字符串?
答案 0 :(得分:1)
自己想出来,事实证明,如果不直观,它很容易:
<property name="testAssemblies" value=""></property>
<target name="test">
<call target="clientSideTests" />
<foreach item="File" property="filename">
<in>
<items>
<include name="bin\*Test.dll" />
<include name="bin\*Tests.dll" />
</items>
</in>
<do>
<property name="testAssemblies" value='${testAssemblies} "${filename}"'></property>
</do>
</foreach>
<echo>Executing serverSideTests for ${testAssemblies}</echo>
<tstamp />
<exec program="${devenv.test}\VSTest.Console.exe" commandline='${testAssemblies} /TestCaseFilter:"TestCategory!=Debugging|TestCategory!=Upgrade" /Settings:"vstest.runsettings"' failonerror="true" />
<tstamp />