Xray import cucumber test results to existing test execution giving error

rafaelBauer October 31, 2019

Hello,

 

I've been trying to import cucumber test results to an existing test execution using the REST API provided by Xray (https://confluence.xpand-it.com/display/public/XRAY/Import+Execution+Results+-+REST#ImportExecutionResults-REST-CucumberJSONresultsMultipart)  but I am not being able. It always creates a new test execution.

Is it possible for me to add to an existing test execution?

My info json file looks likes this:

{
    "fields": {
        "project": {
            "key": "MUL"
        },
        "issuetype": {
            "id": "10302"
        }
    }
}

When I run:

curl -u username:password -F info=@execution.json -F result=@resultCucumber.json https://mydomain.com/rest/raven/1.0/import/execution/cucumber/multipart

I get the follwoing error:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>500</status-code><message>com.atlassian.jira.rest.v2.issue.FieldMetaBean.&lt;init&gt;(ZLjava/lang/Boolean;Lcom/atlassian/jira/issue/fields/rest/json/JsonType;Ljava/lang/String;Ljava/lang/String;Ljava/util/Collection;Ljava/util/Collection;)V</message><stack-trace>java.lang.NoSuchMethodError: com.atlassian.jira.rest.v2.issue.FieldMetaBean.&lt;init&gt;(ZLjava/lang/Boolean;Lcom/atlassian/jira/issue/fields/rest/json/JsonType;Ljava/lang/String;Ljava/lang/String;Ljava/util/Collection;Ljava/util/Collection;)V
at com.xpandit.raven.rest.internal.jira.AbstractMetaFieldBeanBuilder.a(Unknown Source)
at com.xpandit.raven.rest.internal.jira.AbstractMetaFieldBeanBuilder.build(Unknown Source)
at com.xpandit.raven.rest.internal.jira.CreateMetaFieldBeanBuilder.build(Unknown Source)
at com.xpandit.raven.rest.internal.jira.a.a(Unknown Source)
at com.xpandit.raven.rest.internal.jira.a.a(Unknown Source)
at com.xpandit.raven.rest.internal.jira.a.a(Unknown Source)
at com.xpandit.raven.rest.internal.jira.IssueInputParametersAssembler.makeCreateAssembler(Unknown Source)
at com.xpandit.raven.service.executionresult.impl.ExecutionResultImportServiceImpl.b(Unknown Source)
at com.xpandit.raven.service.executionresult.impl.ExecutionResultImportServiceImpl.a(Unknown Source)
at com.xpandit.raven.rest.internal.c.a.b(Unknown Source)
at sun.reflect.GeneratedMethodAccessor17797.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker$1.invoke(DispatchProviderHelper.java:192)
at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$1.intercept(DispatchProviderHelper.java:83)
at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:53)
at com.atlassian.plugins.rest.common.expand.interceptor.ExpandInterceptor.intercept(ExpandInterceptor.java:41)
at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:53)
at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper.invokeMethodWithInterceptors(DispatchProviderHelper.java:110)
at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker._dispatch(DispatchProviderHelper.java:190)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
at
... More errors, I had to delete due to characters limit
</stack-trace></status>

 

1 answer

1 accepted

3 votes
Answer accepted
José Domingues [Xray]
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 6, 2019

Hi Rafael, 

To import the Execution Results to an existing Test Execution, you have to export the original cucumber feature file from the Test Execution itself. In this way, the feature file you're exporting it does the reference by a tag to the Test Execution (Test Execution issue key) that you want to import the Execution results. So, when you execute your Tests in the CI environment, the Execution results file that is being generated will also contain the tag that does the reference to the existing Test Execution and Xray will recognize it and will import the results to that Test Execution.

Best Regards, 

Team Xray 

Michał Rusiecki March 24, 2020

Hi,

 

I have similar problem as author of this issue, but I am trying to import results to specific Test Execution via Jenkins plugin. I found documentation https://confluence.xpand-it.com/display/public/XRAY/Integration+with+Jenkins and there is said that if I chose "Cucumber JSON Multipart" results type, I would have an additional field named "Import to Same Test Execution" appeared. Currently this field is not available

 

Configuration

XRay for Jira: 2.2.0

rafaelBauer March 24, 2020

Hello, Michal,

When you want to import the cucumber test results to a specific test execution you should add the test execution key to the tags field of the cucumber feature.

You can see where to add it exactly if you create a test execution manually, add the cucumber tests there and then export the test execution to cucumber. You will see that for every ".feature" file, there will be a tag with the test execution key. This tag will be in your json afterwards and then Xray will import the results to that test execution.

Michał Rusiecki March 24, 2020

Hi Rafael,

 

thanks for info, I am going to test it :)

 

Don't you think that endpoint for importing Cucumber results should support test execution key? I found that JUnit and other endpoints support it as query param or key in Test Info object, but Cucumber endpoints lacks support for it?

 

In my opinion this will be valuable feature for your customers because when I would have store my feature in VCS as root repository for all features files, then I need to update them before each run if I want to upload results to single Test Execution

 

Regaards,

Michal

rafaelBauer March 24, 2020

Unfortunately I am not a developer of Xpand-it... I'm just a guy that also struggled with this and after trying out a lot of things I discovered this hahahaha

But I don't know, they might have had a reason to do it this way.

Michał Rusiecki March 24, 2020

haha, I got it, so you manually update tags in features in order to upload them into one test execution?

rafaelBauer March 24, 2020

I think you can do that.

Initially I wanted to always update the same test execution (so I have a CI test execution). I was fetching the test execution it self, but then I found out that if I did that, I was always fetching the same test steps even though I have changed them. The test execution creates test runs of the tests (which contains the steps) so after running the test once, it would never change again.

Now I am creating a new test execution every time I merge my code into master.  I am fetching the test plan (I have a CI test plan) and running all the tests in that test plan in all branches, but the only branch that pushes the results back to Xray is the master branch. At the end, this helps a bit to see the evolution of the project in terms of the number of tests being executed.

Like Aravind Kesavarapu likes this
Aravind Kesavarapu August 12, 2021

Yes, i agree your point cucumber lacks when it compared other types of reports.

I am also facing same. Whenever I want to change test execution i have to pass to my feature file.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events