admin管理员组

文章数量:1122832

I'm trying to build an Azure pipeline that can read test results so that I can automatically update their status in Test Plans. The only way I've been able to print off test results that the Visual Studio Test task can read in the pipeline is to run it through NUnit-3 Console on a command prompt as an Administrator.

This XML file does not appear to have any style information associated with it. The document tree is shown below. Here is an example of a test results file that was run through NUnit3 Console:

<test-run id="0" runstate="Runnable" testcasecount="10134" result="Failed" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0" engine-version="3.15.4.0" clr-version="4.0.30319.42000" start-time="2024-11-21 16:06:59Z" end-time="2024-11-21 16:17:13Z" duration="614.046341">
  <command-line>
    <![CDATA[ nunit3-console.exe C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\bin\Debug\Trintech.Tests.Cadency.dll --where cat=JEActivePeriods ]]>
  </command-line>
  <filter>
    <cat>JEActivePeriods</cat>
  </filter>
  <test-suite type="Assembly" id="1-12601" name="Trintech.Tests.Cadency.dll" fullname="Trintech.Tests.Cadency.dll" runstate="Runnable" testcasecount="10134" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.891640" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
    <environment framework-version="3.11.0.0" clr-version="4.0.30319.42000" os-version="Microsoft Windows NT 10.0.22631.0" platform="Win32NT" cwd="C:\Program Files (x86)\NUnit\nunit-console" machine-name="PLN-1PPPYD3" user="cstarnes" user-domain="TRINTECH" culture="en-US" uiculture="en-US" os-architecture="x64" />
    <settings>
      <setting name="DisposeRunners" value="True" />
      <setting name="WorkDirectory" value="C:\Program Files (x86)\NUnit\nunit-console" />
      <setting name="ImageRuntimeVersion" value="4.0.30319" />
      <setting name="ImageTargetFrameworkName" value=".NETFramework,Version=v4.6.1" />
      <setting name="ImageRequiresX86" value="False" />
      <setting name="ImageRequiresDefaultAppDomainAssemblyResolver" value="False" />
      <setting name="TargetRuntimeFramework" value="net-4.6.1" />
      <setting name="NumberOfTestWorkers" value="12" />
    </settings>
    <properties>
      <property name="ParallelScope" value="Fixtures" />
      <property name="LevelOfParallelism" value="1" />
      <property name="_PID" value="22832" />
      <property name="_APPDOMAIN" value="domain-" />
    </properties>
    <failure>
      <message>
        <![CDATA[ One or more child tests had errors ]]>
      </message>
    </failure>
    <test-suite type="TestSuite" id="1-12602" name="Trintech" fullname="Trintech" runstate="Runnable" testcasecount="10134" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.874161" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
      <properties />
      <failure>
        <message>
          <![CDATA[ One or more child tests had errors ]]>
        </message>
      </failure>
      <test-suite type="TestSuite" id="1-12603" name="Tests" fullname="Trintech.Tests" runstate="Runnable" testcasecount="10134" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.873782" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
        <properties />
        <failure>
          <message>
            <![CDATA[ One or more child tests had errors ]]>
          </message>
        </failure>
        <test-suite type="TestSuite" id="1-12604" name="Cadency" fullname="Trintech.Tests.Cadency" runstate="Runnable" testcasecount="10134" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.873771" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
          <properties />
          <failure>
            <message>
              <![CDATA[ One or more child tests had errors ]]>
            </message>
          </failure>
          <test-suite type="TestSuite" id="1-12605" name="SpecFlow" fullname="Trintech.Tests.Cadency.SpecFlow" runstate="Runnable" testcasecount="10132" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.873763" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
            <properties />
            <failure>
              <message>
                <![CDATA[ One or more child tests had errors ]]>
              </message>
            </failure>
            <test-suite type="TestSuite" id="1-12606" name="Features" fullname="Trintech.Tests.Cadency.SpecFlow.Features" runstate="Runnable" testcasecount="10132" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.873748" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
              <properties />
              <failure>
                <message>
                  <![CDATA[ One or more child tests had errors ]]>
                </message>
              </failure>
              <test-suite type="TestSuite" id="1-12629" name="JournalEntries" fullname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries" runstate="Runnable" testcasecount="1934" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.873676" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
                <properties />
                <failure>
                  <message>
                    <![CDATA[ One or more child tests had errors ]]>
                  </message>
                </failure>
                <test-suite type="TestFixture" id="1-6091" name="JEActivePeriodsFeature" fullname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature" classname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature" runstate="Runnable" testcasecount="3" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.871865" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
                  <properties>
                    <property name="Description" value="JEActivePeriods" />
                    <property name="Category" value="JEActivePeriods" />
                    <property name="Category" value="JERegression" />
                  </properties>
                  <failure>
                    <message>
                      <![CDATA[ One or more child tests had errors ]]>
                    </message>
                  </failure>
                  <output>
                    <![CDATA[ -> Using app.config TRX log file saved to: C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\bin\Debug\TrxLogs\TestResults_20241121_100702.trx TRX log file will be saved to: C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\bin\Debug\TrxLogs TRX log file saved to: C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\bin\Debug\TrxLogs\JEActivePeriods_D1Wo9-10-07-03-166.trx ]]>
                  </output>
                  <test-case id="1-6094" name="ActivePeriodsNoErrorMessageWhenExporting" fullname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ActivePeriodsNoErrorMessageWhenExporting" methodname="ActivePeriodsNoErrorMessageWhenExporting" classname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature" runstate="Runnable" seed="785896656" result="Failed" label="Error" start-time="2024-11-21 16:07:04Z" end-time="2024-11-21 16:17:09Z" duration="605.048497" asserts="0">
                    <properties>
                      <property name="Description" value="Active Periods: No Error Message when exporting" />
                      <property name="Category" value="112271" />
                    </properties>
                    <failure>
                      <message>
                        <![CDATA[ OpenQA.Selenium.WebDriverException : Failed to find element with locator By.XPath: //a[contains(@href, 'Certification/Dashboard/Index')]. Error message: disconnected: not connected to DevTools (failed to check if window was closed: disconnected: not connected to DevTools) (Session info: chrome=131.0.6778.86) TearDown : OpenQA.Selenium.WebDriverException : disconnected: not connected to DevTools (failed to check if window was closed: disconnected: not connected to DevTools) (Session info: chrome=131.0.6778.86) ]]>
                      </message>
                      <stack-trace>
                        <![CDATA[ at Trintech.Tests.Utils.Browser.FindElement[T](By locator, Int32 timeoutMsec, Boolean waitForVisible, Boolean checkForAngular) in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Utils\Browser.cs:line 438 at Trintech.Tests.Utils.Browser.FindElement[T](By locator, Boolean waitForVisible, Boolean checkForAngular) in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Utils\Browser.cs:line 397 at Trintech.Tests.Utils.Browser.FindElement(By locator, Boolean waitForVisible) in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Utils\Browser.cs:line 384 at Trintech.Tests.Cadency.CertificationPage.OpenManagementMenu() in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\Pages\Certification\CertificationPage.cs:line 1085 at Trintech.Tests.Cadency.ManagementDashboardSteps.WhenINavigateToTheActivePeriodsPage() in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\SpecFlow\Steps\Certification\Management\ManagementDashboardSteps.cs:line 1736 at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() at Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ScenarioCleanup() at Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ActivePeriodsNoErrorMessageWhenExporting() in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\SpecFlow\Features\JournalEntries\JEActivePeriods.feature:line 78 --TearDown at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute) at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.WebDriver.get_WindowHandles() at Trintech.Tests.Cadency.Hooks.AfterScenario(FeatureContext featureContext, ScenarioContext scenarioContext) in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\SpecFlow\Hooks\Hooks.cs:line 764 at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioEnd() at Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ScenarioTearDown() ]]>
                      </stack-trace>
                    </failure>
                    <output>
                      <![CDATA[ Given I login as 'jeautouser' -> done: LoginSteps.GivenILoginAs("jeautouser") (5.6s) When I Navigate to Certification Page -> done: DashboardPageSteps.WhenINavigateToCertificationPage() (3.1s) And I navigate to the Active Periods page -> error: Failed to find element with locator By.XPath: //a[contains(@href, 'Certification/Dashboard/Index')]. Error message: disconnected: not connected to DevTools (failed to check if window was closed: disconnected: not connected to DevTools) (Session info: chrome=131.0.6778.86) Then I Verify Export button is Working on Active Periods -> skipped because of previous errors And I validate that active periods file is exported within 30 seconds -> skipped because of previous errors Then I verify the Active Periods export: --- table step argument --- | Display Name | Period | Year | Start | End | Effective Date | Status | -> skipped because of previous errors TRX log file saved to: C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\bin\Debug\TrxLogs\JEActivePeriods_D1Wo9-10-07-03-166.trx ]]>
                    </output>
                  </test-case>
                  <test-case id="1-6092" name="CorrectErrorMessageAppearsWhenDeletingActivePeriodInUseBySR" fullname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.CorrectErrorMessageAppearsWhenDeletingActivePeriodInUseBySR" methodname="CorrectErrorMessageAppearsWhenDeletingActivePeriodInUseBySR" classname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature" runstate="Ignored" seed="1867787410" result="Skipped" label="Ignored" start-time="2024-11-21 16:17:09Z" end-time="2024-11-21 16:17:09Z" duration="0.000759" asserts="0">
                    <properties>
                      <property name="Description" value="Correct error message appears when deleting Active Period in use by SR" />
                      <property name="_SKIPREASON" value="Ignored scenario" />
                      <property name="Category" value="122627" />
                    </properties>
                    <reason>
                      <message>
                        <![CDATA[ Ignored scenario ]]>
                      </message>
                    </reason>
                  </test-case>
                  <test-case id="1-6093" name="ModernizedActivePeriodsValidateTheLayoutAndFunctionalityOfTheActivePeriodsDashboard" fullname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ModernizedActivePeriodsValidateTheLayoutAndFunctionalityOfTheActivePeriodsDashboard" methodname="ModernizedActivePeriodsValidateTheLayoutAndFunctionalityOfTheActivePeriodsDashboard" classname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature" runstate="Runnable" seed="29488523" result="Failed" label="Error" start-time="2024-11-21 16:17:09Z" end-time="2024-11-21 16:17:09Z" duration="0.018234" asserts="0">
                    <properties>
                      <property name="Description" value="Modernized Active Periods: Validate the layout and functionality of the active periods dashboard" />
                      <property name="Category" value="123994" />
                    </properties>
                    <failure>
                      <message>
                        <![CDATA[ OpenQA.Selenium.WebDriverException : disconnected: not connected to DevTools (failed to check if window was closed: disconnected: not connected to DevTools) (Session info: chrome=131.0.6778.86) TearDown : System.Collections.Generic.KeyNotFoundException : The given key was not present in the dictionary. ]]>
                      </message>
                      <stack-trace>
                        <![CDATA[ at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute) at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.WebDriver.InternalExecute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.CookieJar.GetAllCookies() at OpenQA.Selenium.CookieJar.get_AllCookies() at Trintech.Tests.Cadency.Hooks.BeforeScenario(FeatureContext featureContext, ScenarioContext scenarioContext) in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\SpecFlow\Hooks\Hooks.cs:line 480 at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType) at Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ScenarioStart() at Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ModernizedActivePeriodsValidateTheLayoutAndFunctionalityOfTheActivePeriodsDashboard() in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\SpecFlow\Features\JournalEntries\JEActivePeriods.feature:line 15 --TearDown at System.ThrowHelper.ThrowKeyNotFoundException() at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Trintech.Tests.Cadency.Hooks.AfterScenario(FeatureContext featureContext, ScenarioContext scenarioContext) in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\SpecFlow\Hooks\Hooks.cs:line 743 at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioEnd() at Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ScenarioTearDown() ]]>
                      </stack-trace>
                    </failure>
                    <output>
                      <![CDATA[ -> warning: The previous ScenarioContext was not disposed. TRX log file saved to: C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\bin\Debug\TrxLogs\JEActivePeriods_D1Wo9-10-07-03-166.trx ]]>
                    </output>
                  </test-case>
                </test-suite>
              </test-suite>
            </test-suite>
          </test-suite>
        </test-suite>
      </test-suite>
    </test-suite>
  </test-suite>
</test-run>

I want to either be able to do one of two things:

  1. Run NUnit-3 Console through an Azure Pipeline task so that I no longer have run it externally and then paste its results file into the "Test results folder" manually. Remember, at the moment I can only run Nunit3 Console through the Command Prompt if I do so as an administrator. Not sure what permissions I would have to get to have Command Prompt Administrator privileges on an Azule pipeline task, or if there's a way to run it without doing so as an administrator. Right now I only seem to be able to run command line scripts as a non-administrator on the pipeline, using the "Command line" task.

  2. Get the same test results format another way, or at least in a way that can also be interpretable to the Visual Studio Test task within an Azure Pipeline.

I'm trying to build an Azure pipeline that can read test results so that I can automatically update their status in Test Plans. The only way I've been able to print off test results that the Visual Studio Test task can read in the pipeline is to run it through NUnit-3 Console on a command prompt as an Administrator.

This XML file does not appear to have any style information associated with it. The document tree is shown below. Here is an example of a test results file that was run through NUnit3 Console:

<test-run id="0" runstate="Runnable" testcasecount="10134" result="Failed" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0" engine-version="3.15.4.0" clr-version="4.0.30319.42000" start-time="2024-11-21 16:06:59Z" end-time="2024-11-21 16:17:13Z" duration="614.046341">
  <command-line>
    <![CDATA[ nunit3-console.exe C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\bin\Debug\Trintech.Tests.Cadency.dll --where cat=JEActivePeriods ]]>
  </command-line>
  <filter>
    <cat>JEActivePeriods</cat>
  </filter>
  <test-suite type="Assembly" id="1-12601" name="Trintech.Tests.Cadency.dll" fullname="Trintech.Tests.Cadency.dll" runstate="Runnable" testcasecount="10134" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.891640" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
    <environment framework-version="3.11.0.0" clr-version="4.0.30319.42000" os-version="Microsoft Windows NT 10.0.22631.0" platform="Win32NT" cwd="C:\Program Files (x86)\NUnit.org\nunit-console" machine-name="PLN-1PPPYD3" user="cstarnes" user-domain="TRINTECH" culture="en-US" uiculture="en-US" os-architecture="x64" />
    <settings>
      <setting name="DisposeRunners" value="True" />
      <setting name="WorkDirectory" value="C:\Program Files (x86)\NUnit.org\nunit-console" />
      <setting name="ImageRuntimeVersion" value="4.0.30319" />
      <setting name="ImageTargetFrameworkName" value=".NETFramework,Version=v4.6.1" />
      <setting name="ImageRequiresX86" value="False" />
      <setting name="ImageRequiresDefaultAppDomainAssemblyResolver" value="False" />
      <setting name="TargetRuntimeFramework" value="net-4.6.1" />
      <setting name="NumberOfTestWorkers" value="12" />
    </settings>
    <properties>
      <property name="ParallelScope" value="Fixtures" />
      <property name="LevelOfParallelism" value="1" />
      <property name="_PID" value="22832" />
      <property name="_APPDOMAIN" value="domain-" />
    </properties>
    <failure>
      <message>
        <![CDATA[ One or more child tests had errors ]]>
      </message>
    </failure>
    <test-suite type="TestSuite" id="1-12602" name="Trintech" fullname="Trintech" runstate="Runnable" testcasecount="10134" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.874161" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
      <properties />
      <failure>
        <message>
          <![CDATA[ One or more child tests had errors ]]>
        </message>
      </failure>
      <test-suite type="TestSuite" id="1-12603" name="Tests" fullname="Trintech.Tests" runstate="Runnable" testcasecount="10134" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.873782" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
        <properties />
        <failure>
          <message>
            <![CDATA[ One or more child tests had errors ]]>
          </message>
        </failure>
        <test-suite type="TestSuite" id="1-12604" name="Cadency" fullname="Trintech.Tests.Cadency" runstate="Runnable" testcasecount="10134" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.873771" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
          <properties />
          <failure>
            <message>
              <![CDATA[ One or more child tests had errors ]]>
            </message>
          </failure>
          <test-suite type="TestSuite" id="1-12605" name="SpecFlow" fullname="Trintech.Tests.Cadency.SpecFlow" runstate="Runnable" testcasecount="10132" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.873763" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
            <properties />
            <failure>
              <message>
                <![CDATA[ One or more child tests had errors ]]>
              </message>
            </failure>
            <test-suite type="TestSuite" id="1-12606" name="Features" fullname="Trintech.Tests.Cadency.SpecFlow.Features" runstate="Runnable" testcasecount="10132" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.873748" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
              <properties />
              <failure>
                <message>
                  <![CDATA[ One or more child tests had errors ]]>
                </message>
              </failure>
              <test-suite type="TestSuite" id="1-12629" name="JournalEntries" fullname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries" runstate="Runnable" testcasecount="1934" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.873676" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
                <properties />
                <failure>
                  <message>
                    <![CDATA[ One or more child tests had errors ]]>
                  </message>
                </failure>
                <test-suite type="TestFixture" id="1-6091" name="JEActivePeriodsFeature" fullname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature" classname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature" runstate="Runnable" testcasecount="3" result="Failed" site="Child" start-time="2024-11-21 16:07:01Z" end-time="2024-11-21 16:17:13Z" duration="611.871865" total="3" passed="0" failed="2" warnings="0" inconclusive="0" skipped="1" asserts="0">
                  <properties>
                    <property name="Description" value="JEActivePeriods" />
                    <property name="Category" value="JEActivePeriods" />
                    <property name="Category" value="JERegression" />
                  </properties>
                  <failure>
                    <message>
                      <![CDATA[ One or more child tests had errors ]]>
                    </message>
                  </failure>
                  <output>
                    <![CDATA[ -> Using app.config TRX log file saved to: C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\bin\Debug\TrxLogs\TestResults_20241121_100702.trx TRX log file will be saved to: C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\bin\Debug\TrxLogs TRX log file saved to: C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\bin\Debug\TrxLogs\JEActivePeriods_D1Wo9-10-07-03-166.trx ]]>
                  </output>
                  <test-case id="1-6094" name="ActivePeriodsNoErrorMessageWhenExporting" fullname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ActivePeriodsNoErrorMessageWhenExporting" methodname="ActivePeriodsNoErrorMessageWhenExporting" classname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature" runstate="Runnable" seed="785896656" result="Failed" label="Error" start-time="2024-11-21 16:07:04Z" end-time="2024-11-21 16:17:09Z" duration="605.048497" asserts="0">
                    <properties>
                      <property name="Description" value="Active Periods: No Error Message when exporting" />
                      <property name="Category" value="112271" />
                    </properties>
                    <failure>
                      <message>
                        <![CDATA[ OpenQA.Selenium.WebDriverException : Failed to find element with locator By.XPath: //a[contains(@href, 'Certification/Dashboard/Index')]. Error message: disconnected: not connected to DevTools (failed to check if window was closed: disconnected: not connected to DevTools) (Session info: chrome=131.0.6778.86) TearDown : OpenQA.Selenium.WebDriverException : disconnected: not connected to DevTools (failed to check if window was closed: disconnected: not connected to DevTools) (Session info: chrome=131.0.6778.86) ]]>
                      </message>
                      <stack-trace>
                        <![CDATA[ at Trintech.Tests.Utils.Browser.FindElement[T](By locator, Int32 timeoutMsec, Boolean waitForVisible, Boolean checkForAngular) in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Utils\Browser.cs:line 438 at Trintech.Tests.Utils.Browser.FindElement[T](By locator, Boolean waitForVisible, Boolean checkForAngular) in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Utils\Browser.cs:line 397 at Trintech.Tests.Utils.Browser.FindElement(By locator, Boolean waitForVisible) in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Utils\Browser.cs:line 384 at Trintech.Tests.Cadency.CertificationPage.OpenManagementMenu() in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\Pages\Certification\CertificationPage.cs:line 1085 at Trintech.Tests.Cadency.ManagementDashboardSteps.WhenINavigateToTheActivePeriodsPage() in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\SpecFlow\Steps\Certification\Management\ManagementDashboardSteps.cs:line 1736 at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() at Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ScenarioCleanup() at Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ActivePeriodsNoErrorMessageWhenExporting() in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\SpecFlow\Features\JournalEntries\JEActivePeriods.feature:line 78 --TearDown at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute) at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.WebDriver.get_WindowHandles() at Trintech.Tests.Cadency.Hooks.AfterScenario(FeatureContext featureContext, ScenarioContext scenarioContext) in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\SpecFlow\Hooks\Hooks.cs:line 764 at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioEnd() at Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ScenarioTearDown() ]]>
                      </stack-trace>
                    </failure>
                    <output>
                      <![CDATA[ Given I login as 'jeautouser' -> done: LoginSteps.GivenILoginAs("jeautouser") (5.6s) When I Navigate to Certification Page -> done: DashboardPageSteps.WhenINavigateToCertificationPage() (3.1s) And I navigate to the Active Periods page -> error: Failed to find element with locator By.XPath: //a[contains(@href, 'Certification/Dashboard/Index')]. Error message: disconnected: not connected to DevTools (failed to check if window was closed: disconnected: not connected to DevTools) (Session info: chrome=131.0.6778.86) Then I Verify Export button is Working on Active Periods -> skipped because of previous errors And I validate that active periods file is exported within 30 seconds -> skipped because of previous errors Then I verify the Active Periods export: --- table step argument --- | Display Name | Period | Year | Start | End | Effective Date | Status | -> skipped because of previous errors TRX log file saved to: C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\bin\Debug\TrxLogs\JEActivePeriods_D1Wo9-10-07-03-166.trx ]]>
                    </output>
                  </test-case>
                  <test-case id="1-6092" name="CorrectErrorMessageAppearsWhenDeletingActivePeriodInUseBySR" fullname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.CorrectErrorMessageAppearsWhenDeletingActivePeriodInUseBySR" methodname="CorrectErrorMessageAppearsWhenDeletingActivePeriodInUseBySR" classname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature" runstate="Ignored" seed="1867787410" result="Skipped" label="Ignored" start-time="2024-11-21 16:17:09Z" end-time="2024-11-21 16:17:09Z" duration="0.000759" asserts="0">
                    <properties>
                      <property name="Description" value="Correct error message appears when deleting Active Period in use by SR" />
                      <property name="_SKIPREASON" value="Ignored scenario" />
                      <property name="Category" value="122627" />
                    </properties>
                    <reason>
                      <message>
                        <![CDATA[ Ignored scenario ]]>
                      </message>
                    </reason>
                  </test-case>
                  <test-case id="1-6093" name="ModernizedActivePeriodsValidateTheLayoutAndFunctionalityOfTheActivePeriodsDashboard" fullname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ModernizedActivePeriodsValidateTheLayoutAndFunctionalityOfTheActivePeriodsDashboard" methodname="ModernizedActivePeriodsValidateTheLayoutAndFunctionalityOfTheActivePeriodsDashboard" classname="Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature" runstate="Runnable" seed="29488523" result="Failed" label="Error" start-time="2024-11-21 16:17:09Z" end-time="2024-11-21 16:17:09Z" duration="0.018234" asserts="0">
                    <properties>
                      <property name="Description" value="Modernized Active Periods: Validate the layout and functionality of the active periods dashboard" />
                      <property name="Category" value="123994" />
                    </properties>
                    <failure>
                      <message>
                        <![CDATA[ OpenQA.Selenium.WebDriverException : disconnected: not connected to DevTools (failed to check if window was closed: disconnected: not connected to DevTools) (Session info: chrome=131.0.6778.86) TearDown : System.Collections.Generic.KeyNotFoundException : The given key was not present in the dictionary. ]]>
                      </message>
                      <stack-trace>
                        <![CDATA[ at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute) at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.WebDriver.InternalExecute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.CookieJar.GetAllCookies() at OpenQA.Selenium.CookieJar.get_AllCookies() at Trintech.Tests.Cadency.Hooks.BeforeScenario(FeatureContext featureContext, ScenarioContext scenarioContext) in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\SpecFlow\Hooks\Hooks.cs:line 480 at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType) at Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ScenarioStart() at Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ModernizedActivePeriodsValidateTheLayoutAndFunctionalityOfTheActivePeriodsDashboard() in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\SpecFlow\Features\JournalEntries\JEActivePeriods.feature:line 15 --TearDown at System.ThrowHelper.ThrowKeyNotFoundException() at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Trintech.Tests.Cadency.Hooks.AfterScenario(FeatureContext featureContext, ScenarioContext scenarioContext) in C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\SpecFlow\Hooks\Hooks.cs:line 743 at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioEnd() at Trintech.Tests.Cadency.SpecFlow.Features.JournalEntries.JEActivePeriodsFeature.ScenarioTearDown() ]]>
                      </stack-trace>
                    </failure>
                    <output>
                      <![CDATA[ -> warning: The previous ScenarioContext was not disposed. TRX log file saved to: C:\Users\cstarnes\source\repos\CadencyAuto\CadencyAuto\Trintech.Tests.Cadency\bin\Debug\TrxLogs\JEActivePeriods_D1Wo9-10-07-03-166.trx ]]>
                    </output>
                  </test-case>
                </test-suite>
              </test-suite>
            </test-suite>
          </test-suite>
        </test-suite>
      </test-suite>
    </test-suite>
  </test-suite>
</test-run>

I want to either be able to do one of two things:

  1. Run NUnit-3 Console through an Azure Pipeline task so that I no longer have run it externally and then paste its results file into the "Test results folder" manually. Remember, at the moment I can only run Nunit3 Console through the Command Prompt if I do so as an administrator. Not sure what permissions I would have to get to have Command Prompt Administrator privileges on an Azule pipeline task, or if there's a way to run it without doing so as an administrator. Right now I only seem to be able to run command line scripts as a non-administrator on the pipeline, using the "Command line" task.

  2. Get the same test results format another way, or at least in a way that can also be interpretable to the Visual Studio Test task within an Azure Pipeline.

Share Improve this question edited Nov 24, 2024 at 6:28 JeffC 25.4k5 gold badges34 silver badges55 bronze badges asked Nov 21, 2024 at 17:04 ColeCole 352 silver badges8 bronze badges 2
  • Please paste the correspondent pipeline code - at least the Visual Studio Test task code. I never used Azure Test Plans but I'm pretty sure it can be integrated with Azure Pipelines. I really doubt you need to use the NUnit Console in the build server. Search for test plan in the task documentation. – Rui Jarimba Commented Nov 21, 2024 at 22:43
  • Hi @Cole, you can run NUnit-3 Console in the pipeline without Administrator privilege, see my answer below for installing and running nunit3-console.exe in the pipeline. – Ziyang Liu-MSFT Commented Nov 25, 2024 at 7:33
Add a comment  | 

1 Answer 1

Reset to default 0

You can run NUnit-3 Console in Azure DevOps pipeline without Administrator privilege.

Refer to the example below:

pool:
  vmImage: windows-latest

variables:
  buildConfiguration: 'Release'

steps:
- task: PowerShell@2
  displayName: 'Install choco'
  inputs:
    targetType: 'inline'
    script: |
      Set-ExecutionPolicy Bypass -Scope Process -Force; `
      [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
      iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- task: CmdLine@2
  displayName: 'Install nunit-console-runner'
  inputs:
    script: |
      choco install nunit-console-runner
    workingDirectory: 'PrimeService.Tests'
- task: CmdLine@2
  displayName: 'Run tests'
  inputs:
    script: 'nunit3-console.exe --result=TestResult.xml;format=nunit3 {Path to your assembly}'
- task: PublishTestResults@2
  displayName: 'Publish test result'
  inputs:
    testResultsFormat: 'NUnit'
    testResultsFiles: '**/TestResult.xml'

Result:

本文标签: azure devopsHow to print off xml test result from Selenium in same format as NUnit ConsoleStack Overflow