Xray-App / xray-maven-plugin

Xray Maven Plugin
BSD 3-Clause "New" or "Revised" License
26 stars 12 forks source link

Associate TestExec to Test Plan #82

Closed MaherAccor closed 4 months ago

MaherAccor commented 4 months ago

Hello , I want to associate the testExec to testPlan after an execution of automation tests . It works with a reportFormat (Junit , Testng) but not works with a reportFormat (Cucumber) . PS: with the format Junit and testNg the information in not clean , can't import all of steps of scenario Outline. This my configuration 👍

Capture d’écran 2024-07-08 à 14 07 12
bitcoder commented 4 months ago

As mentioned on the README, it's not possible to associate the cucumber resuts to an existing Test Plan, among other, using the "standard" cucumber format. This has to be with the nature of the underlying Cucumber REST API endpoint that doesnt support it.

image

You need to use the multipart endpoint instead and provide an auxiliary JSON file (using testExecInfoJson ) to customize the target Test Execution that will be created. You can see an example of the JSON content on this Python script and adapt it aacordingly.

MaherAccor commented 4 months ago

Thank you for your response , can you please show me an example of the multipart endPoint because when using an example in the doc for xray i can't associate the testExec with testPlan we have a lot of URL and all of this URL doesn't works.I saw two version api/v1 and api/v2 . Can you share me the format of the good json File (info and result)

MaherAccor commented 4 months ago
Capture d’écran 2024-07-08 à 16 20 12
bitcoder commented 4 months ago

On the Xray docs you have another example

You can use a testExecInfo.json similar to:

json

{
    "fields": {
        "project": {
            "key": "CALC"
        },
        "summary": "Brand new Test execution",
        "issuetype": {
            "name": "Test Execution"
        }
    },
    "xrayFields": {
        "testPlanKey": "DEMO-15",
        "environments": ["Chrome"]
    }
}

the environments field on the previous JSON is optional.

Then on your maven configuration use the testExecInfoJson property with the name of the file containing the previous JSON.

MaherAccor commented 4 months ago

Thanks 😊 , it works fine now

bitcoder commented 4 months ago

Updated the main README.md file with info on this