介绍
官方源码:https://github.com/Microsoft/WindowsProtocolTestSuites
官方介绍:目录结构
根目录
CommonScripts 依赖脚本
TestSuites 源码
ProtocolTestManager UI工具
ProtoSDK 协议库、SDK等
TestSuites目录
存放所有测试协议套件的源码文档。
基本每个测试套件都由这三个目录组成
Setup文件夹可能被(Scripts或者Setup/Scripts)取代,RDP会多一级目录,分为Server协议和Client协议.
安装
安装步骤可以按照官方给出的文档一步步进行下去,这里介绍的是另一种安装方式。
在最近的更新中,各协议的源码都给出了protocol.xml文件,我们可以根据此配置文件进行环境的搭建,文档的内容作为参考,参数可根据实际情况修改。
这里我们以Kerberos为例,protocol.xml如下
<lab>
<core>
<username>Administrator</username>
<password>Password01!</password>
<legacyclient>true</legacyclient>
<basecpu>1</basecpu>
<Description>DC x 2 and Member x 4(NIC x 1), Kerberos sample setup static ip address</Description>
</core>
<network>
<vnet>
<hostisgateway>true</hostisgateway>
<name>Kerberos-Internal</name>
<networktype>Internal</networktype>
<ip>192.168.21.254</ip>
<subnet>255.255.255.0</subnet>
</vnet>
</network>
<Parameters>
<Parameter Name="DriverVMName" Value="Kerberos-ENDPOINT01" Comment="The name of the driver VM" />
</Parameters>
<servers>
<vm>
<installorder>1</installorder>
<sku>server</sku>
<role>PDC01</role>
<hypervname>Kerberos-DC01</hypervname>
<name>DC01</name>
<username>Administrator</username>
<password>Password01@</password>
<domain>contoso.com</domain>
<isdc>true</isdc>
<vnet>Kerberos-Internal</vnet>
<ip>192.168.21.1</ip>
<subnet>255.255.255.0</subnet>
<gateway></gateway>
<dns>127.0.0.1;192.168.21.2</dns>
<cpu>1</cpu>
<memory>2048</memory>
<configscript>Configure-DC01.ps1</configscript>
<postscript>Kerberos-DC01-Postscript.ps1</postscript>
<restartinpostscript>true</restartinpostscript>
<skipwaitingforpostscript>false</skipwaitingforpostscript>
<trusttargetdomain>kerb.com</trusttargetdomain>
<trustpassword>Password01!</trustpassword>
</vm>
<vm>
<installorder>2</installorder>
<sku>server</sku>
<role>TDC01</role>
<hypervname>Kerberos-DC02</hypervname>
<name>DC02</name>
<username>Administrator</username>
<password>Password01#</password>
<domain>kerb.com</domain>
<isdc>true</isdc>
<vnet>Kerberos-Internal</vnet>
<ip>192.168.21.2</ip>
<subnet>255.255.255.0</subnet>
<gateway></gateway>
<dns>127.0.0.1;192.168.21.1</dns>
<cpu>1</cpu>
<memory>2048</memory>
<postscript>Kerberos-DC02-Postscript.ps1</postscript>
<configscript>Configure-DC02.ps1</configscript>
<restartinpostscript>true</restartinpostscript>
<skipwaitingforpostscript>false</skipwaitingforpostscript>
<trusttargetdomain>contoso.com</trusttargetdomain>
<trustpassword>Password01!</trustpassword>
<trusttargetserver>DC01.contoso.com</trusttargetserver>
<trusttargetuser>CONTOSO\Administrator</trusttargetuser>
<trusttargetpwd>Password01@</trusttargetpwd>
</vm>
<vm>
<installorder>3</installorder>
<sku>server</sku>
<role>AP01</role>
<hypervname>Kerberos-AP01</hypervname>
<name>AP01</name>
<username>Administrator</username>
<password>Password01!</password>
<domain>contoso.com</domain>
<vnet>Kerberos-Internal</vnet>
<ip>192.168.21.10</ip>
<subnet>255.255.255.0</subnet>
<gateway></gateway>
<dns>192.168.21.1</dns>
<cpu>1</cpu>
<memory>2048</memory>
<installfeaturescript>Install-FSRM.ps1;Install-IIS.ps1;Install-ADDS.ps1</installfeaturescript>
<postscript>Kerberos-AP01-Postscript.ps1</postscript>
<configscript>Configure-AP01.ps1</configscript>
<restartinpostscript>true</restartinpostscript>
<skipwaitingforpostscript>false</skipwaitingforpostscript>
<dcserver>DC01.contoso.com</dcserver>
<dcuser>CONTOSO\Administrator</dcuser>
<dcpwd>Password01@</dcpwd>
</vm>
<vm>
<installorder>4</installorder>
<sku>server</sku>
<role>AP02</role>
<hypervname>Kerberos-AP02</hypervname>
<name>AP02</name>
<username>Administrator</username>
<password>Password01!</password>
<domain>kerb.com</domain>
<vnet>Kerberos-Internal</vnet>
<ip>192.168.21.20</ip>
<subnet>255.255.255.0</subnet>
<gateway></gateway>
<dns>192.168.21.2</dns>
<cpu>1</cpu>
<memory>2048</memory>
<installfeaturescript>Install-FSRM.ps1;Install-IIS.ps1;Install-ADDS.ps1</installfeaturescript>
<postscript>Kerberos-AP02-Postscript.ps1</postscript>
<configscript>Configure-AP02.ps1</configscript>
<restartinpostscript>true</restartinpostscript>
<skipwaitingforpostscript>false</skipwaitingforpostscript>
<dcserver>DC02.kerb.com</dcserver>
<dcuser>KERB\Administrator</dcuser>
<dcpwd>Password01#</dcpwd>
</vm>
<vm>
<installorder>5</installorder>
<sku>server</sku>
<role>PROXY01</role>
<hypervname>Kerberos-PROXY01</hypervname>
<name>PROXY01</name>
<username>Administrator</username>
<password>Password01!</password>
<domain>contoso.com</domain>
<vnet>Kerberos-Internal</vnet>
<ip>192.168.21.3</ip>
<subnet>255.255.255.0</subnet>
<gateway></gateway>
<dns>192.168.21.1;192.168.21.2</dns>
<cpu>1</cpu>
<memory>2048</memory>
<installfeaturescript>Install-IIS.ps1</installfeaturescript>
<postscript>Kerberos-PROXY01-Postscript.ps1</postscript>
<configscript>Configure-PROXY.ps1</configscript>
<restartinpostscript>true</restartinpostscript>
<skipwaitingforpostscript>false</skipwaitingforpostscript>
</vm>
<vm>
<installorder>6</installorder>
<sku>client</sku>
<role>DriverComputer</role>
<hypervname>Kerberos-ENDPOINT01</hypervname>
<name>ENDPOINT01</name>
<username>Administrator</username>
<password>Password01!</password>
<domain>contoso.com</domain>
<vnet>Kerberos-Internal</vnet>
<ip>192.168.21.101</ip>
<subnet>255.255.255.0</subnet>
<gateway></gateway>
<dns>192.168.21.1;192.168.21.2</dns>
<cpu>1</cpu>
<memory>4096</memory>
<localdcserver>DC01.contoso.com</localdcserver>
<localapserver>AP01.contoso.com</localapserver>
<localdcuser>CONTOSO\Administrator</localdcuser>
<localdcpwd>Password01@</localdcpwd>
<trustdcserver>DC02.kerb.com</trustdcserver>
<trustapserver>AP02.kerb.com</trustapserver>
<trustdcuser>KERB\Administrator</trustdcuser>
<trustdcpwd>Password01#</trustdcpwd>
<postscript>Kerberos-ENDPOINT01-Postscript.ps1</postscript>
<configscript>Configure-ENDPOINT.ps1</configscript>
<restartinpostscript>true</restartinpostscript>
<skipwaitingforpostscript>false</skipwaitingforpostscript>
<tools>
<tool name="SE" MSIName="SpecExplorer.msi" version="3.5.3146.0" CPUArchitecture="x86" />
<tool name="PTF" MSIName="ProtocolTestFrameworkInstaller.msi" version="1.0.6000.0" CPUArchitecture="x86" />
<TestsuiteMSI MSIName="Kerberos-TestSuite-ServerEP.msi" targetEndpoint="" />
</tools>
</vm>
</servers>
</lab>
介绍一下比较重要的几个标签,没有的协议可以忽略。
<network>标签
网卡的配置<vm>标签
所有测试虚拟(物理)机的详细信息,此标签的数量代表了建议测试使用的机器数量,如与文档不一致时,可根据实际情况,自行选择或结合使用。-
<role>标签
值可可分为两种:DriverComputer 和 SUT(System Under Test),用于安装 (Protocol)-TestSuite-ServerEP.msi 时进行选择。(通常除了标明为DriverComputer的都是SUT)。
<postscripts><installscript><postiso><installfeaturescript><configscript>等
此类标签带有脚本,执行优先级由高到低为
<postiso> & <installscript> (安装所需软件)
<installfeaturescript>(设置或安装windows feature)
<postscripts> (关闭防火墙配置域等)
<configscript>(配置测试环境)<tool><TestsuiteMSI>标签
环境所需安装的软件,可在项目内或微软官网找到下载即可,注意所需版本号。<name><ip><username><password><subnet><gateway><dns>标签,只需保持名称与测试目录下的 (Protocol)TestSuite.deployment.ptfconfig一致即可,此目录安装 SpecExplorer.msi 后自行生成,通常在C:\MicrosoftProtocolTests\Kerberos\ < version # > \Bin。
按照此配置文档进行环境搭建后,按照官方的测试方法或直接运行Driver机桌面上的TestCase即可验证。
示例
- 以Kerberos协议为例,首先从 GitHub 下载整个项目,然后执行对应协议目录下的 build.cmd 进行编译,有些动态生成的文件是没有放到GitHub上的!
-
找到 Protocol.xml 文件,根据文件说明进行配置:
(1)创建六台虚拟(物理)机,系统要求请查看官方文档。
(2)修改机器机器名,IP,网关,DNS等,重启机器,通过ping命令等方式检查连接情况。
(3)根据<tool>标签安装相应的软件
(4)执行<installfeaturescript>内的脚本
(5)执行<postscript>内的脚本,由于涉及加域等步骤,需要按照先DC后其他的顺序执行,一般可按照此文档的机器编号顺序执行。
(6)执行<configscript>标签,完成安装。
测试
测试方面官网比较详细,这里不再赘述,可简单概括为:修改配置文件((Protocol)TestSuite.deployment.ptfconfig),运行Driver机桌面的RunAllTestCase.cmd (名字略有差异),查看TestResult的结果。
欢迎来我的博客查看更多文章