nant - 将特定文件名连接成一个字符串
nant - concatenate specific file names into a single string
我试图让所有文件名通过某个过滤器进入由 space 分隔的单个变量。
这个有效:
<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 ...
我为什么要这样做,结合上面的内容,我将使用 运行settings 来并行化上面的不同测试集。
如何将文件名连接成单个 space 分隔字符串?
我自己弄明白了,事实证明,即使不直观也很容易:
<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 />
我试图让所有文件名通过某个过滤器进入由 space 分隔的单个变量。
这个有效:
<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 ...
我为什么要这样做,结合上面的内容,我将使用 运行settings 来并行化上面的不同测试集。
如何将文件名连接成单个 space 分隔字符串?
我自己弄明白了,事实证明,即使不直观也很容易:
<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 />