Skip to content

abhinavminhas/qtest-mstest-parser

Repository files navigation

qTest-MSTest-Parser

qTest parser for MSTest (.trx) test result files.

qtest-mstest-parser codecov maintainer License: MIT GitHub Release

Tricentis qTest is a Test Management tool. It's centralizing automated test execution and management, qTest Launch enables enterprises to scale test automation.

Problem Statement: So far no in-built parser is available for MSTest (.trx) test result files in qTest, but qTest offers the option to create and use custom parsers which is what has been attempted here for MSTest (.trx) test result file types.

Features

  1. Can parse multiple MSTest test result (.trx) files.

  2. Generated output log file attachment details.

    == OUTPUT == 
    <This section contains console/test context output logs>
    
    == ERROR INFO (MESSAGE) == 
    <This section contains error message in case of test failure>
    
    == ERROR INFO (STACKTRACE) == 
    <This section contains error details in case of test failure>
    
    == RESULT FILE ATTACHMENTS == 
    <This section lists out all test result attachment files>
    

    [Example]

  3. Parser mapping configuration as per qTest automation mapping under 'Automation Settings'

    MSTest test outcome statuses Mapped qTest automation status
    Failed FAIL
    Inconclusive SKIP
    Passed PASS
    Error FAIL
    Timeout FAIL
    Aborted FAIL
    Unknown SKIP
    NotExecuted SKIP

Steps To Configure:

  1. Download zipped parser from latest release under Releases.
    Artifact Name: "qtest-mstest-parser.zip".

    It can also be downloaded form latest successful "qTest-MSTest-Parser" workflow artifacts.

    • Required zipped file contents (for manually creating zipped file)

      node_modules/
      package.json
      package-lock.json
      parser.js
      

      NOTE: Generated 'node_modules' package folder also needs to be part of the zipped file.

  2. Login to qTest and open 'Launch' from menu < >.

  3. Open settings < > and click 'ADD'.

  4. Add below parser details and 'SAVE'.

    • Name: <name of parser>
    • Version: <version of parser>
    • Zip package: <path to the downloaded parser .zip file>

  5. Once the parser is saved the custom parser should be created in the list.

Configure Automation Host Agent To Use The Parser:

  1. From automation host agent add new agent and provide below details.

    • Agent Name: <name of agent>
    • qTest Manager Project: <qTest project to execute automated tests for>
    • Agent Type: "Universal Agent"
    • Pre-Execute Script: <pre-execute script>
    • Execute Command: <execution script>
    • Path to Results: <path to the test result (.trx) files>
    • Result Parser: <MSTest (custom) parser added above>

    NOTE: Ensure the final command in 'Executor' block does not generate failed output (e.g. test run with failed tests), may avoid the parser from executing. To avoid try adding log output command in the end. (e.g. batch -> echo Completed)

    [ Example ]
    echo :::: EXECUTION STARTED ::::
    <Path to>\VsTest.console.exe <Path to>\Test.dll /TestCaseFilter:Name=Test1 /Logger:trx;LogFileName=TestResultFile.trx
    echo :::: EXECUTION COMPLETED ::::
    

Parsed Test Results:

  1. Results parsed for test run.

  2. Multiple test runs created for a particular test case run executed multiple times in a day.

  3. Log attachments created for each test run.