2011-03-30 33 views
9

takımını bulamıyorum ve ben komut mstest /testsettings:local.Testsetting /testcontainer:folder\obj\Debug\test.dllMSTest ben <p>MSTest</p> kullanıyordum

ve bu çıkışı,

kullanmak Uyarı: test Çalışma dağıtım sorunu: montaj veya modül 'Microsoft.Practices

çalıştırın aşağıdaki sorunu (lar) var. Prism 'doğrudan veya dolaylı olarak test konteyner' test.dll 'başvurulan bulunamadı. Uyarı: Test Çalıştır dağıtım konuşması: 'Project.Common.dll' derlemesi veya modülü dolaylı olarak test kapsayıcısında 'test.dll' başvurulan başvurulan bulunamadı. Uyarı: Test Çalıştır dağıtımı sorunu: 'Project.Infrastructure.dll' veya derlemesi veya dolaylı olarak test kapsayıcısında 'test.dll' başvurulan başvurulan modül bulunamadı. Uyarı: Test Çalıştır dağıtım sorunu: Montaj veya modül 'Microsoft.Practices. Prism 'doğrudan veya dolaylı olarak test konteyner' test.dll 'başvurulan bulunamadı.

MSTest'in iyi çalışabilmesi için ne yapabilirim?

cevap

4

Prism dosyasını yapı sunucunuzun GAC'sine yükleyebilirsiniz.

+0

OWH sorunumu ben benzer bir hata alıyorum – aeruL

2

Doğrudan testte kullanılmayan tüm montajlar, test klasörüne kopyalanmayacaktır. GAC montaj eklemeden

[DeploymentItem("Microsoft.Practices.Prism.dll")] 

Bu sorunu çözer: O halde, bu test yöntemleri gibi özniteliği ile dekore edilmelidir.

+2

çözmek 's, teşekkür ve proje Jenkins de binada yer almaktadır. Çözümün Jenkins'de nasıl kullanılır? Uyarı: Test Çalıştırması dağıtımı sorunu: Doğrudan veya dolaylı olarak test kabı tarafından başvurulan 'zlib.net' modülü 'd: \ alm_jenprodslave_1 \ workspace \ total fund \ alm \ otpp.pivot.core \ otpp.pivot.core.model .test \ bin \ debug \ otpp.pivot.core.model.test.dll 'bulunamadı. –

+0

Bu yaklaşım (sadece ismi kullanarak), montaj GAC'ta OLMADIĞINDA kesinlikle çalışır mı? Sorun yaşıyorum ve bunun yerine tam dosya yolunu koymak zorunda kaldım. – Dib

0

Tamam. DeploymentItem, bunu düzeltmenin bir yoludur. Ancak, DeploymentItem biraz kırılgandır.

İşte bunu nasıl düzelttim.

"Geçerli dizin" DeploymentItem ile aynı hizaya gelmelidir. Bulduğum en iyi uzlaşma, geçerli dizinin .sln dosyasının olduğu yere ayarlanmasıdır.

Klasörüm yapısı.

C:\SomeRootFolder\ 
C:\SomeRootFolder\MySolution.sln 
C:\SomeRootFolder\packages\ 
C:\SomeRootFolder\packages\MyNugetPackage.1.2.3.4\lib\net45\SomeThirdPartyDll.dll 
C:\SomeRootFolder\MyTestProject\MyTestProject.csproj 
C:\SomeRootFolder\MyTestProject\MyTestClass.cs 

MyTestClass.cs

[TestClass] 
public class MyTestClass 
{ 
    [TestMethod] 
    /* The DeploymentItem item below is for error ::: Warning: Test Run deployment issue: The assembly or module 'SomeDll' directly or indirectly referenced by the test container 'C:\SomeRootFolder\MyTestProject\bin\debug\MyTestProject.dll' was not found. */ 
    /* There must be a CD (to the .sln folder) command... before the MsTest.exe command is executed */ 
    [DeploymentItem(@".\packages\MyNugetPackage.1.2.3.4\lib\net45\SomeDll.dll")] 
    public void MyTest() 
    { 
    } 
} 

"hile"

.sln evler klasöre CD (değişim dizini) yapmaktır. "Geçerli dizin" (CD'nin sonuç) de olduğu için

REM Now the normal restore,build lines 
nuget.exe restore "C:\SomeRootFolder\MySolution.sln" 
REM the above nuget restore would create "C:\SomeRootFolder\packages\MyNugetPackage.1.2.3.4\lib\net45\SomeThirdPartyDll.dll" 
MSBuild.exe "C:\SomeRootFolder\MySolution.sln" /p:Configuration=Debug;FavoriteFood=Popeyes /l:FileLogger,Microsoft.Build.Engine;logfile=MySolution.Debug.Build.log 
REM (the below line is the trick to line up the 'current folder' with the relative path of the DeploymentItem) 
cd "C:\SomeRootFolder\" 
REM now the below will work without the annoying message, note that C:\SomeRootFolder\MyTestProject\bin\Debug\SomeThirdPartyDll.dll exists 
MsTest.exe /testcontainer:"C:\SomeRootFolder\MyTestProject\bin\Debug\MyTestProject.dll" /resultsfile:MyTestProject.Dll.Results.trx 

Şimdi "C: \ SomeRootFolder \", DeploymentItem göreli yol düzgün çalışır.

Jimminy Crickets ....... Bu biraz nutsy.

Not Paul Taylor

Running MsTest from the command line with a custom assembly base directory

benim için işe yaramadı burada cevap.

0

en kolay yol. Sadece yeni eklenen koda bir kesme noktası ekleme (Test yönteminin başlangıç ​​noktasında) kodunuzu

string value = AppDomain.CurrentDomain.BaseDirectory; 

ekleyip value değişkenin yolunu ne olduğunu kontrol.

Test işlemine devam edin ve her şey başarılı olduktan sonra values değişken klasörüne gidin.

Klasör içindeki tüm dosyaları görebilirsiniz. Sadece bunları kopyalayın ve geçmiş eşyalarınızı istediğiniz gibi kopyalayın ve mstest komut satırı aracını kullanarak proje dll dosyasını yürütün.

set mstestPath="C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE" 

%mstestpath%\mstest /testcontainer:CodedUITestProject1.dll 
İlgili konular