Xray-App / xray-maven-plugin

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

I can't get mvn xray:export-features -Dxray.filterId=10031 to work #49

Closed MaaikeFox closed 2 years ago

MaaikeFox commented 2 years ago

Hello

I hope you can help me out.

I'm using the plugin to get my java cucumber test results from code/pipeline into XRay

import-features now works

now for export-features: The command is: mvn xray:export-features -Dxray.filterId=10031

Which results in 400 Bad request. With debugger I found out the error body (would be great if the plugin itself would show the error body on an error): {"error":"Error fetching filter information"}

The Jira filterId filters for the test set that contains the test cases that need to be exported after the import. I would expect this to work since it is an indirect reference to the test cases I need to export. Documentation states: "id of the Jira filter containing direct or indirect references to Cucumber/Gherkin tests/scenarios". This filter is created on the same user that is used for the API requests

So something is wrong with the filter, somehow. What should I do differently?

configuration in the pom.xml:

  <plugin>
    <groupId>app.getxray</groupId>
    <artifactId>xray-maven-plugin</artifactId>
    <version>0.6.0</version>
    <configuration>
      <abortOnError>true</abortOnError>
      <inputFeatures>src/test/resources/nl/etpa/idcons/features</inputFeatures>
      <outputDir>src/test/resources/nl/etpa/idcons/features</outputDir>

      <clientId>xxx</clientId>
      <clientSecret>yyy</clientSecret>
      <projectKey>IDCONS</projectKey>
      <cloud>true</cloud>
      <reportFormat>cucumber</reportFormat>
      <reportFile>target/cucumber-reports/integration-test-report.json</reportFile>
    </configuration>
  </plugin>

Thanks for helping me out

MaaikeFox commented 2 years ago

I've also tried it with a filter that contains the actual test case issues and not just the test set that contains the test cases. Still I get a 400 Bad request.

MaaikeFox commented 2 years ago

By the way, the import-features command is succesful: mvn clean compile xray:import-features -Dxray.updateRepository=true

The export-features and also the import-results commands result in a 400 bad request

bitcoder commented 2 years ago

Hi @MaaikeFox ,

  1. related to exporting the features, can you please try the following:
  1. concerning the import of results, the error can be due to many causes. It would help if we could isolate it.

We could try using curl for example. Can you create a cloud_auth.json with these contents (please replace xxx and yyy)

{ "client_id": "xxx","client_secret": "yyy" }

And then invoke these commands (please adjust the name of the cucumber json report file)

export token=$(curl -H "Content-Type: application/json" -X POST --data @"cloud_auth.json" https://xray.cloud.getxray.app/api/v2/authenticate| tr -d '"')
curl -H "Content-Type: application/json" -X POST -H "Authorization: Bearer $token"  --data @"cucumber.json" https://xray.cloud.getxray.app/api/v2/import/execution/cucumber

To see if that works or not. I'm not sure if it's viable, but it would help if you could share your cucumber json report here.

bitcoder commented 2 years ago

Meanwhile, I've created a branch with verbose mode marked for 0.7.0-SNAPSHOT- To run it, (after building & installing this locally)

mvn -X -Dxray.verbose=true ...

bitcoder commented 2 years ago

I've release a new version 0.7.0 with verbose mode. Have you tried my suggestions above?

MaaikeFox commented 2 years ago

Hi Sergio. Thanks a lot! I'm working on it. Since I'm not proficient with Java myself I have to rely a bit on a developer that needs to help me, since on intstalling the plugin I get this error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:3.0.1:sign (sign-artifacts) on project xray-maven-plugin: Execution sign-artifacts of goal org.apache.maven.plugins:maven-gpg-plugin:3.0.1:sign failed: Cannot invoke "org.apache.maven.plugins.gpg.GpgVersion.toString()" because "gpgVersion" is null -> [Help 1]

I've asked a developer on my team, but maybe you can quickly see why I cant install 0.7.0 version of the plugin? Since it is not yet on maven central, I can't yet just add it to the pom as plugin

bitcoder commented 2 years ago

Hi Maaike, for some reason it didn't get published to Maven Central. Let me check that.

Concerning the error you're having it's related to the local build process.. you should not need that (let me focus on making the plugin avaiable for 0.7.0)

bitcoder commented 2 years ago

Note: for building and installing a local copy, should be something like this mvn clean compile verify package install

bitcoder commented 2 years ago

Version 0.7.0 was published to Maven Central. May take a bit to be available.

bitcoder commented 2 years ago

Have you solved this? Can we close this issue?

MaaikeFox commented 2 years ago

It got a bit deprioritized because it took long to get it working. Currently working on it again.

I've had all three request running without errors, so good progress! But not all tests were run. This is probably an issue on our side, but I'm investigating this

bitcoder commented 2 years ago

Friendly reminder: if this is not a problem anymore and unless there is additional feedback, I'll close this issue for better management of this project