2015-12-03 49 views
1

我已經構建了一個GenericTest來將CasperJs測試與TFS測試用例相關聯。Visual Studio Enterprise GenericTest測試運行部署問題

<?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="testproject\Site\Login\Index.js" /> 
    <DeploymentItem filename="testproject\Site\Settings.js" /> 
    <DeploymentItem filename="testproject\Site\Navigation.js" /> 
    <DeploymentItem filename="testproject\Site\History\Index.js" /> 
    <DeploymentItem filename="testproject\Tests\LoginWithEmail.js" /> 
    </DeploymentItems> 
    <Command filename="C:\tools\CasperJs\1.1.b\bin\casperjs.exe" arguments="test &quot;testproject\Tests\LoginWithEmail.js&quot; --ignore-ssl-errors=true" maxDuration="0" workingDirectory="%TestOutputDirectory%" /> 
    <SummaryXmlFile path="%TestOutputDirectory%\&lt;Enter summary file name here&gt;" /> 
</GenericTest> 

但是當我運行從測試資源管理器的測試中,我得到了錯誤:

Warning: Test Run deployment issue: Failed to get the file for deployment item 'testproject\Site\Login\Index.js' specified by the test 'login with email': System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Windows\system32\testproject\Site\Login\Index.js'. 
Warning: Test Run deployment issue: Failed to get the file for deployment item 'testproject\Site\Settings.js' specified by the test 'login with email': System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Windows\system32\testproject\Site\Settings.js'. 
Warning: Test Run deployment issue: Failed to get the file for deployment item 'testproject\Site\Navigation.js' specified by the test 'login with email': System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Windows\system32\testproject\Site\Navigation.js'. 
Warning: Test Run deployment issue: Failed to get the file for deployment item 'testproject\Site\History\Index.js' specified by the test 'login with email': System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Windows\system32\testproject\Site\History\Index.js'. 
Warning: Test Run deployment issue: Failed to get the file for deployment item 'testproject\Tests\LoginWithEmail.js' specified by the test 'login with email': System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Windows\system32\testproject\Tests\LoginWithEmail.js'. 
========== Run test finished: 1 run (0:00:14.346) ========== 

任何想法,爲什麼?

回答

0

看起來您正在使用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 &quot;testproject\Tests\LoginWithEmail.js&quot; --ignore-ssl-errors=true" maxDuration="0" workingDirectory="%TestOutputDirectory%" /> 
    <SummaryXmlFile path="%TestOutputDirectory%\&lt;Enter summary file name here&gt;" /> 
</GenericTest> 
相關問題