TFS 构建和测试影响

发布于 2025-01-01 00:57:10 字数 5304 浏览 1 评论 0原文

我正在尝试 TFS 构建的测试影响功能。 如果您使用 .vsdmi 文件,则似乎无法使用此功能,但前提是您使用 .testsettings 文件(尽管 VSDMI 文件包含对测试设置文件的引用)。

我已在测试设置文件中允许测试影响,等等 TFS 构建配置。 我需要使用 VSDMi 文件的原因是我创建了一个想要在 CI 中执行的测试列表。问题是所有版本都显示“无影响测试”,尽管我知道有一些。

我在这里错过了什么吗?请查找附件中的 vsdmi 文件、测试设置文件和 TFS 构建配置的快照。

Config

这是 .testsettings 文件的内容:

<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="Master" id="68af9170-92f5-49d8-83dd-827359a79042" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
  <Description>These are default test settings for a local test run.</Description>
  <Deployment>
    <DeploymentItem filename="..\Common\Terra.Environment.Common.Data.Test\TpEnvFileParser\InputFiles\" />
    <DeploymentItem filename="..\Common\Terra.Environment.Fake\FakeData\HSW\Resources" />
    <DeploymentItem filename="..\Tpie.Engines.Build\Tpie.Engines.Build.Test\ExpectedFiles\" />
    <DeploymentItem filename="..\Tpie.Engines.Build\Tpie.Engines.Build.Test\Resources\" />
    <DeploymentItem filename="..\Common\Terra.Environment.Common.Model\bin\Debug\TerraEntitiesModel.ssdl" />
    <DeploymentItem filename="..\Common\Terra.Environment.Common.Model\bin\Debug\TerraEntitiesModel.csdl" />
    <DeploymentItem filename="..\Common\Terra.Environment.Common.Data.Test\PListFileParser\InputFiles\" />
    <DeploymentItem filename="..\Common\Terra.Environment.Common.Model\bin\Debug\TerraEntitiesModel.msl" />
    <DeploymentItem filename="..\Tpie.Client\Tpie.Client.Common.Test\ExcelParsers\InputFiles\" />
    <DeploymentItem filename="..\Tpie.Engines.Build\Tpie.Engines.Build.TestProgram\Templates\" />
  </Deployment>
  <Execution>
    <ExecutionThread apartmentState="MTA" />
    <Timeouts runTimeout="1800000" testTimeout="300000" />
    <TestTypeSpecific>
      <UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
        <AssemblyResolution>
          <TestDirectory useLoadContext="true" />
        </AssemblyResolution>
      </UnitTestRunConfig>
      <WebTestRunConfiguration testTypeId="4e7599fa-5ecb-43e9-a887-cd63cf72d207">
        <Browser name="Internet Explorer 7.0">
          <Headers>
            <Header name="User-Agent" value="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" />
            <Header name="Accept" value="*/*" />
            <Header name="Accept-Language" value="{{$IEAcceptLanguage}}" />
            <Header name="Accept-Encoding" value="GZIP" />
          </Headers>
        </Browser>
      </WebTestRunConfiguration>
    </TestTypeSpecific>
    <AgentRule name="LocalMachineDefaultRole">
      <DataCollectors>
        <DataCollector uri="datacollector://Microsoft/TestImpact/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TraceCollector.TestImpactDataCollector, Microsoft.VisualStudio.TraceCollector, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
        </DataCollector>
      </DataCollectors>
    </AgentRule>
  </Execution>
</TestSettings>

这是 .vsmdi 文件:

<?xml version="1.0" encoding="UTF-8"?>
<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
  <TestList name="TPIE Auto Build" id="2cbc1525-8079-4959-a126-4d4fb8fdb803" parentListId="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
    <TestLinks>
      <TestLink id="ee8dae77-c23e-df6b-c6b5-4be930087750" name="LevelTestConditionGroupCheckCalculationDataTypeVoltageTest" storage="..\tpie.client\tpie.client.common.test\bin\debug\tpie.client.common.test.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      <TestLink id="74441000-f8e5-ac1b-fbd6-bb94da0bf3ce" name="LevelPowerSequenceBlockCheckSequenceElementTest" storage="..\tpie.client\tpie.client.common.test\bin\debug\tpie.client.common.test.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      <TestLink id="afb21bed-4eff-9f9f-7e58-c72e7d133b32" name="TestGetMiscEnvironmentVariables" storage="..\server\terra.binmatrix.server.test\bin\debug\terra.server.bl.test.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </TestLinks>
  </TestList>
  <TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
    <RunConfiguration id="68af9170-92f5-49d8-83dd-827359a79042" name="Master" storage="master.testsettings" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </TestList>
</TestLists>

谢谢, 布西

I'm playing around with the Test Impact feature of TFS build.
It seems like you cannot use this feature if you are using a .vsdmi file, but only if you use a .testsettings file (although the VSDMI file includes a reference to the test settings file).

I have allowed Test Impact in the test settings file, and so on the TFS build configuration.
The reason I need to use the VSDMi file is that I created a test list that i want to be executed in CI. The problem is that all builds show "No Impacted Test" though I know there are some.

Am I missing something here? Please find attached the vsdmi file, the testsettings file and a snapshot of the TFS build configuration.

Config

Here is the content of the .testsettings file:

<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="Master" id="68af9170-92f5-49d8-83dd-827359a79042" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
  <Description>These are default test settings for a local test run.</Description>
  <Deployment>
    <DeploymentItem filename="..\Common\Terra.Environment.Common.Data.Test\TpEnvFileParser\InputFiles\" />
    <DeploymentItem filename="..\Common\Terra.Environment.Fake\FakeData\HSW\Resources" />
    <DeploymentItem filename="..\Tpie.Engines.Build\Tpie.Engines.Build.Test\ExpectedFiles\" />
    <DeploymentItem filename="..\Tpie.Engines.Build\Tpie.Engines.Build.Test\Resources\" />
    <DeploymentItem filename="..\Common\Terra.Environment.Common.Model\bin\Debug\TerraEntitiesModel.ssdl" />
    <DeploymentItem filename="..\Common\Terra.Environment.Common.Model\bin\Debug\TerraEntitiesModel.csdl" />
    <DeploymentItem filename="..\Common\Terra.Environment.Common.Data.Test\PListFileParser\InputFiles\" />
    <DeploymentItem filename="..\Common\Terra.Environment.Common.Model\bin\Debug\TerraEntitiesModel.msl" />
    <DeploymentItem filename="..\Tpie.Client\Tpie.Client.Common.Test\ExcelParsers\InputFiles\" />
    <DeploymentItem filename="..\Tpie.Engines.Build\Tpie.Engines.Build.TestProgram\Templates\" />
  </Deployment>
  <Execution>
    <ExecutionThread apartmentState="MTA" />
    <Timeouts runTimeout="1800000" testTimeout="300000" />
    <TestTypeSpecific>
      <UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
        <AssemblyResolution>
          <TestDirectory useLoadContext="true" />
        </AssemblyResolution>
      </UnitTestRunConfig>
      <WebTestRunConfiguration testTypeId="4e7599fa-5ecb-43e9-a887-cd63cf72d207">
        <Browser name="Internet Explorer 7.0">
          <Headers>
            <Header name="User-Agent" value="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" />
            <Header name="Accept" value="*/*" />
            <Header name="Accept-Language" value="{{$IEAcceptLanguage}}" />
            <Header name="Accept-Encoding" value="GZIP" />
          </Headers>
        </Browser>
      </WebTestRunConfiguration>
    </TestTypeSpecific>
    <AgentRule name="LocalMachineDefaultRole">
      <DataCollectors>
        <DataCollector uri="datacollector://Microsoft/TestImpact/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TraceCollector.TestImpactDataCollector, Microsoft.VisualStudio.TraceCollector, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
        </DataCollector>
      </DataCollectors>
    </AgentRule>
  </Execution>
</TestSettings>

And here is the .vsmdi file:

<?xml version="1.0" encoding="UTF-8"?>
<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
  <TestList name="TPIE Auto Build" id="2cbc1525-8079-4959-a126-4d4fb8fdb803" parentListId="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
    <TestLinks>
      <TestLink id="ee8dae77-c23e-df6b-c6b5-4be930087750" name="LevelTestConditionGroupCheckCalculationDataTypeVoltageTest" storage="..\tpie.client\tpie.client.common.test\bin\debug\tpie.client.common.test.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      <TestLink id="74441000-f8e5-ac1b-fbd6-bb94da0bf3ce" name="LevelPowerSequenceBlockCheckSequenceElementTest" storage="..\tpie.client\tpie.client.common.test\bin\debug\tpie.client.common.test.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      <TestLink id="afb21bed-4eff-9f9f-7e58-c72e7d133b32" name="TestGetMiscEnvironmentVariables" storage="..\server\terra.binmatrix.server.test\bin\debug\terra.server.bl.test.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </TestLinks>
  </TestList>
  <TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
    <RunConfiguration id="68af9170-92f5-49d8-83dd-827359a79042" name="Master" storage="master.testsettings" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </TestList>
</TestLists>

Thanks,
Busi

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梓梦 2025-01-08 00:57:10

这有点棘手,但很有效。
如果要运行测试影响分析,您需要设置 Disable Test = trueAnalyse Test Impact = true

我已经完成了以下

  • 创建 CI 构建类型,使用 vsmdi
  • 设置构建来运行测试(禁用测试 = false),
  • 选择 vsmdi
  • 运行两个或三个构建来收集测试数据,
  • 切换标志,如上所述

在此处输入图像描述

It is a little bit tricky, but it works.
If you want to run the test impact analysis you need to set Disable Test = true and Analyse Test Impact = true.

I have done the following

  • create CI build type with the vsmdi
  • setup the build to run the tests (Disable Tests = false)
  • select the vsmdi
  • run two or three builds to collect test data
  • switch the flags like described above

enter image description here

柳若烟 2025-01-08 00:57:10

您需要使用以下步骤来运行测试。

  1. 使禁用测试 = False
  2. Anyalyze 测试影响 = true;
  3. 确保在运行测试时,您的构建从 vsmdi 文件中提到的指定位置获取测试 dll。
  4. 调试构建日志时设置 Logging Verbosity=Diagnostic。
    通过这个你可以看到日志,无论你的构建是否正在获取测试 dll。

You need to use the below steps to run your test.

  1. Make Disable Tests= False
  2. Anyalyze Test Impact= true;
  3. make sure that while running test your build is getting the test dll's from the specified location as mention in the vsmdi file.
  4. while debugging your build log set Logging Verbosity=Diagnostic.
    through this you can see the log whether your build is getting test dll or not.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文