Xray-App / xray-maven-plugin

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

400 http error using multipart behavior #54

Closed rbecerraj closed 1 year ago

rbecerraj commented 1 year ago

When i tried to use a separate file to customize the test execution i always get 400 http error, we are using xray cloud, if i do the same using postman multipart works, i also tried adding some other keys like jiraBaseUrl, jiraToken but i always have the same response

pom.xml

<plugin>
   <groupId>app.getxray</groupId>
   <artifactId>xray-maven-plugin</artifactId>
   <version>0.7.0</version>
   <configuration>
      <scope>test</scope>
      <clientId>***</clientId>
      <clientSecret>***</clientSecret>
      <cloud>true</cloud>
      <reportFormat>cucumber</reportFormat>
      <testExecInfoJson>src/main/resources/xrayInfo.json</testExecInfoJson>
      <reportFile>${project.build.directory}/cucumber-reports/cucumber-report.json</reportFile>
      <abortOnError>true</abortOnError>
   </configuration>
</plugin>

error

java.io.IOException: Unexpected HTTP code Response{protocol=http/1.1, code=400, message=Bad Request, url=https://xray.cloud.getxray.app/api/v2/import/execution/cucumber/multipart}
    at app.getxray.xray.XrayResultsImporter.submitMultipartCloud(XrayResultsImporter.java:427)
    at app.getxray.maven.plugin.xray.ImportResultsMojo.execute(ImportResultsMojo.java:215)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:301)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:211)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:165)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:157)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:121)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:127)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:577)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[ERROR] Unexpected HTTP code Response{protocol=http/1.1, code=400, message=Bad Request, url=https://xray.cloud.getxray.app/api/v2/import/execution/cucumber/multipart}
java.io.IOException: Unexpected HTTP code Response{protocol=http/1.1, code=400, message=Bad Request, url=https://xray.cloud.getxray.app/api/v2/import/execution/cucumber/multipart}
    at app.getxray.xray.XrayResultsImporter.submitMultipartCloud(XrayResultsImporter.java:427)
    at app.getxray.maven.plugin.xray.ImportResultsMojo.execute(ImportResultsMojo.java:215)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:301)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:211)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:165)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:157)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:121)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:127)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:577)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)

xrayInfo.json

{
  "fields": {
    "summary": "Test execution, 2023/01/26 09:33:50",
    "issuetype": {
      "id": "issue_type_id"
    },
    "project": {
      "id": "project_id"
    },
    "description": "Automated test execution, Platform: android, Date: 2023/01/26 09:33:50",
    "assignee": {
      "id": "assigned_id"
    }
  }
}

command to execute tests

 mvn clean test -Dcucumber.filter.tags="@login" xray:import-results

i hope you can take a look. Thanks

bitcoder commented 1 year ago

Thanks for reporting. I'll have a look at it whenever possible. Help is appreciated.

bitcoder commented 1 year ago

Can you run it with verbose mode active? Your xrayInfo.json contents are exactly like what you share or are "issue_type_id", "project_id", and "assigned_id" not actual values?

bitcoder commented 1 year ago

found the issue. fix on the way..