Visual studio Visual Studio Enterprise GenericTest测试运行部署问题
我构建了一个GenericTest,将CasperJs测试与TFS测试用例关联起来Visual studio Visual Studio Enterprise GenericTest测试运行部署问题,visual-studio,automated-tests,microsoft-test-manager,Visual Studio,Automated Tests,Microsoft Test Manager,我构建了一个GenericTest,将CasperJs测试与TFS测试用例关联起来 但是,当我从测试资源管理器运行测试时,会出现以下错误: 警告:测试运行部署问题:无法获取由测试“使用电子邮件登录”指定的部署项“testproject\Site\Login\Index.js”的文件:System.IO.DirectoryNotFoundException:找不到路径“C:\Windows\system32\testproject\Site\Login\Index.js”的一部分。 警告:测试
但是,当我从测试资源管理器运行测试时,会出现以下错误:
警告:测试运行部署问题:无法获取由测试“使用电子邮件登录”指定的部署项“testproject\Site\Login\Index.js”的文件:System.IO.DirectoryNotFoundException:找不到路径“C:\Windows\system32\testproject\Site\Login\Index.js”的一部分。
警告:测试运行部署问题:无法获取由测试“通过电子邮件登录”指定的部署项“testproject\Site\Settings.js”的文件:System.IO.DirectoryNotFoundException:找不到路径“C:\Windows\system32\testproject\Site\Settings.js”的一部分。
警告:测试运行部署问题:无法获取由测试“使用电子邮件登录”指定的部署项“testproject\Site\Navigation.js”的文件:System.IO.DirectoryNotFoundException:找不到路径“C:\Windows\system32\testproject\Site\Navigation.js”的一部分。
警告:测试运行部署问题:无法获取由测试“通过电子邮件登录”指定的部署项“testproject\Site\History\Index.js”的文件:System.IO.DirectoryNotFoundException:找不到路径“C:\Windows\system32\testproject\Site\History\Index.js”的一部分。
警告:测试运行部署问题:无法获取由测试“使用电子邮件登录”指定的部署项“testproject\Tests\LoginWithEmail.js”的文件:System.IO.DirectoryNotFoundException:找不到路径“C:\Windows\system32\testproject\Tests\LoginWithEmail.js”的一部分。
=========运行测试已完成:1次运行(0:00:14.346)==========
知道为什么吗?看起来您在DeploymentItems
filename
属性中使用了相对路径。在查找这些文件时,测试运行程序似乎使用
C:\Windows\system32
作为工作目录(根据错误消息)
从GenericTest节点中的storage
属性判断,这些文件位于c:\development\testproject\
中。因此,您必须将其添加到部署项的路径中:
<?xml version="1.0" encoding="UTF-8" ?>
<GenericTest name="Login With Email" storage="c:\development\testproject\tests\generic\login with email.generictest" id="0d5c40d3-2224-4adf-9a5b-7ef5b6e61f3a" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<DeploymentItems>
<DeploymentItem filename="c:\development\testproject\Site\Login\Index.js" />
<DeploymentItem filename="c:\development\testproject\Site\Settings.js" />
<DeploymentItem filename="c:\development\testproject\Site\Navigation.js" />
<DeploymentItem filename="c:\development\testproject\Site\History\Index.js" />
<DeploymentItem filename="c:\development\testproject\Tests\LoginWithEmail.js" />
</DeploymentItems>
<Command filename="C:\tools\CasperJs\1.1.b\bin\casperjs.exe" arguments="test "testproject\Tests\LoginWithEmail.js" --ignore-ssl-errors=true" maxDuration="0" workingDirectory="%TestOutputDirectory%" />
<SummaryXmlFile path="%TestOutputDirectory%\<Enter summary file name here>" />
</GenericTest>
看起来您正在使用DeploymentItems
文件名
属性中的相对路径。在查找这些文件时,测试运行程序似乎使用
C:\Windows\system32
作为工作目录(根据错误消息)
从GenericTest节点中的storage
属性判断,这些文件位于c:\development\testproject\
中。因此,您必须将其添加到部署项的路径中:
<?xml version="1.0" encoding="UTF-8" ?>
<GenericTest name="Login With Email" storage="c:\development\testproject\tests\generic\login with email.generictest" id="0d5c40d3-2224-4adf-9a5b-7ef5b6e61f3a" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<DeploymentItems>
<DeploymentItem filename="c:\development\testproject\Site\Login\Index.js" />
<DeploymentItem filename="c:\development\testproject\Site\Settings.js" />
<DeploymentItem filename="c:\development\testproject\Site\Navigation.js" />
<DeploymentItem filename="c:\development\testproject\Site\History\Index.js" />
<DeploymentItem filename="c:\development\testproject\Tests\LoginWithEmail.js" />
</DeploymentItems>
<Command filename="C:\tools\CasperJs\1.1.b\bin\casperjs.exe" arguments="test "testproject\Tests\LoginWithEmail.js" --ignore-ssl-errors=true" maxDuration="0" workingDirectory="%TestOutputDirectory%" />
<SummaryXmlFile path="%TestOutputDirectory%\<Enter summary file name here>" />
</GenericTest>