使用mstest.exe 命令行跑test case(不安装Visual Studio 2010)
来源:互联网 发布:划船机有效吗 知乎 编辑:程序博客网 时间:2024/05/16 00:38
使用mstest.exe 命令行跑test case(不安装Visual Studio 2010)
怎样在没有安装VS2010的环境里用mstest.exe跑test case?(注:以下实验在64位Windows 7上通过)
1. 首先在装有VS2010的环境里,新建一个文件夹,如C:\Users\username\Desktop\mstestCommandLine(注意文件夹名不能有空格,否则运行下面的脚本会有问题),然后把下面的脚本getmstest.bat复制到此目录下,运行getmstest.bat,这个bat会把mstest.exe需要的类库及注册表都导入到当前目录下一个叫mstest的文件夹里
getmstest.bat
@echo offsetlocalset here=%~dp0mkdir mstestset targetfolder=%here%mstestset programs=%programfiles%if exist "%programfiles(x86)%" set programs=%programfiles(x86)%set vs2010="%programs%\Microsoft Visual Studio 10.0"set gac1="%windir%"\assemblyset gac2="%windir%"\Microsoft.NET\assemblyecho === Copying from Visual Studio 2010 install folder...copy %vs2010%\Common7\IDE\mstest* "%targetfolder%"copy %vs2010%\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.Quality* "%targetfolder%"copy %vs2010%\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.CodedUITestFramework* "%targetfolder%"echo === Copying from %gac1%...pushd "%gac1%"dir /s /b *.dll | findstr QualityTools | findstr 10.0.0.0 > %here%tmp.filelistpopdfor /F "tokens=*" %%f in (tmp.filelist) DO copy "%%f" "%targetfolder%"echo === Copying from %gac2%...pushd "%gac2%"dir /s /b *.dll | findstr QualityTools | findstr 10.0.0.0 > %here%tmp.filelistpopdfor /F "tokens=*" %%f in (tmp.filelist) DO copy "%%f" "%targetfolder%"del tmp.filelistecho === Exporting registry keys...regedit.exe /e %targetfolder%\mstest.reg HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\EnterpriseTools\QualityTools\TestTypesecho === Done. Check output for errors!exit /b 0
2. 准备跑test case需要的文件:我把它们放在了C:\Users\username\Desktop\mstestCommandLine\test文件夹里,如下图所示。注意下图里的TestResults为自己新建的文件夹,run case时会用到,用于存储test result。现在,要准备的文件都放在了C:\Users\username\Desktop\mstestCommandLine里
3. 在目标机器上安装.NET Framework 4.0
4. 把C:\Users\username\Desktop\mstestCommandLine文件夹复制到目标机器上,假设复制到目标机器的桌面上
5. 在目标机器上,运行C:\Users\username\Desktop\mstestCommandLine\mstest这个文件夹里的mstest.reg(双击即可)
6.在目标机器上,Run->cmd, 回车,进入mstest.exe所在的文件夹,然后运行下面的命令:
mstest /noisolation /testcontainer:C:\Users\<username>\Desktop\mstest\test\TestProject1.dll /resultsfile:C:\Users\<username>\Desktop\mstest\test\TestResults\result.trx
7. 运行结果如下图所示:
参考:
http://mindinthewater.blogspot.com/2008/11/executing-visual-studio-unit-tests.html
http://mindinthewater.blogspot.com/2011/02/executing-visual-studio-2010-unit-tests.html
- 使用mstest.exe 命令行跑test case(不安装Visual Studio 2010)
- MSTest.exe 命令行选项
- 从命令行使用 MSTest 运行自动测试
- Run Automation Test by MSTest.exe on 64bit OS
- Windows Visual Studio下安装和使用google test(gtest)
- Windows Visual Studio下安装和使用google test(gtest)
- 在Visual Studio 2010中使用Google Test - 配置
- [C++]在Visual Studio 2010中使用Google Test - 配置
- 不安装Visual Studio 使用VC编译器步骤
- 使用 Visual Studio Team Test 进行单元测试
- 从命令行运行自动测试MSTest\ VSTest.Console.exe\ TCM.exe
- Microsoft Visual Studio 2010(vs10)安装与使用
- Visual Studio 2010安装、配置及使用
- 使用Visual Studio 2010制作安装包
- 使用Visual Studio指定命令行参数
- android studio不使用命令行查找SHA1
- Visual Studio 命令行安装方法及离线下载安装包
- visual studio 命令行 build
- 基于mahout的相似度算法的实现
- Spark读写和Lost Excutor错误的分析和解决过程
- js获取li的索引值
- Android快速开发系列 10个常用工具类
- Android中file开头的uri转换为content开头的ur:
- 使用mstest.exe 命令行跑test case(不安装Visual Studio 2010)
- 不再一直翻文件夹了,使用cmd命令吧
- ListView于ScrollView
- NSInternalInconsistencyException Invalid parameter not satisfying: URLString
- js实现marquee头尾无缝滚动
- ARM汇编伪指令学习笔记
- 《编程之美》——电话号码对应英语单词
- ADT版本查看,This Android SDK requires Andr...ate ADT to the latest问题
- Cocos2d-x多场景切换生命周期