Search code examples
azureazure-devopstfsgitlabgitlab-ci

How to transfer gitlab ci testing result to Azure TFS?


We are running automation testing on a gitlab ci pipeline, which will output a testing report(*.xml) as a pipeline artifact. Currently, we'd like to transfer the testing results to Azure TFS, so that QA Engineer could view the testing results from TFS directly. Besides that, it would be better the transferred testing results could be linked or mapped with TFS test case in the Azure TFS.

Based on above requirements, we made a investigation and found that there is a tool in Azure Pipeline called 'Publish Test Results' that would be the solution.

However, since we do not have too much experience on Azure TFS. Is there anyone can let us know if our thinking is correct or not?

Thanks very much!


Solution

  • Based on your description, we are able to use PublishTestResults@2 task of Azure pipelines to publish the generated .xml reports and it can populate the test results in test runs of Azure Test Plans functionality.

    # azure-pipelines.yml
    
    steps:
    - task: PublishTestResults@2
      inputs:
        testResultsFormat: 'JUnit'
        testResultsFiles: '**/TEST-*.xml'
        mergeTestResults: true
    

    Image

    Image

    Image

    However, the other requirement to link/map the test results with the test cases in the Azure DevOps is another story. That may require you to consider moving your source code in Azure Repos and changing your current GitLab CI workflow to build and test via Azure Pipelines, so as to Associate automated tests with test cases and then Run automated tests from test plans.

    As far as I know, there is no built-in method to link the test results output by a GitLab pipeline with the test cases in Azure Test Plans. Or, at least, the PublishTestResults@2 task of Azure Pipelines cannot deal with that.