Forum Discussion

psubrambe's avatar
psubrambe
Occasional Visitor
2 years ago

Unable to Publish Cucumber Tests Results, using Jenkins (zephyr scale plugin).

Hi Team,

 

I am trying to publish cucumber json output to the zephyr scale via tm4j-automation-plugin eventhough file format and content are perfect still not able to publish the results.

 

[Zephyr Scale] [INFO] Publishing test results... [Zephyr Scale] [ERROR] Error: { "errorCode": 400, "message": "Error parsing the following file(s): /var/jenkins_home/jobs/.json - reason: Invalid value '{\"keyword\"=>\"Scenario\", \"type\"=>\"scenario\", \"description\"=>\"\", \"name\"=>\"Account - GET random account number - /api/Account\", \"tags\"=>[], \"id\"=>\"account-number---cabs---loans-stub;account---get-random-account-number---/api/account\", \"steps\"=>[{\"keyword\"=>\"Before\", \"name\"=>\"\", \"result\"=>{\"status\"=>\"passed\", \"duration\"=>20000000}, \"line\"=>nil}, {\"keyword\"=>\"Given\", \"name\"=>\"Channel \\\"OLB\\\"\", \"result\"=>{\"status\"=>\"passed\", \"duration\"=>70000000}, \"line\"=>nil}, {\"keyword\"=>\"And\", \"name\"=>\"SourceSystem \\\"OLB\\\"\", \"result\"=>{\"status\"=>\"passed\", \"duration\"=>60000000}, \"line\"=>nil}, {\"keyword\"=>\"And\", \"name\"=>\"Set defaults of laoStubs for /accountnumber stub endpoint\", \"result\"=>{\"status\"=>\"passed\", \"duration\"=>68000000}, \"line\"=>nil}, {\"keyword\"=>\"When\", \"name\"=>\"a GET /accountnumber request is made to laoStubs mock Api\", \"result\"=>{\"status\"=>\"passed\", \"duration\"=>71000000}, \"line\"=>nil}, {\"keyword\"=>\"And\", \"name\"=>\"I verify the stub response status code as \\\"200\\\"\", \"result\"=>{\"status\"=>\"passed\", \"duration\"=>2059000000}, \"line\"=>nil}, {\"keyword\"=>\"After\", \"name\"=>\"\", \"result\"=>{\"status\"=>\"passed\", \"duration\"=>1000000}, \"line\"=>nil}]}' at path /0/elements/0. Validation schema used: {\"type\"=>\"object\", \"properties\"=>{\"keyword\"=>{\"type\"=>\"string\"}, \"type\"=>{\"type\"=>\"string\"}, \"id\"=>{\"type\"=>\"string\"}, \"line\"=>{\"type\"=>\"integer\"}, \"name\"=>{\"type\"=>\"string\"}, \"tags\"=>{\"type\"=>\"array\", \"items\"=>{\"$ref\"=>\"#/definitions/tag\"}}, \"steps\"=>{\"type\"=>\"array\", \"items\"=>{\"$ref\"=>\"#/definitions/step\"}}}, \"required\"=>[\"type\", \"line\", \"name\"]}. Details: {\"missing_keys\"=>[\"line\"]}\\nInvalid value '' at path /0/elements/0/steps/0/line. Validation schema used: {\"type\"=>\"integer\"}.\\nInvalid value '' at path /0/elements/0/steps/1/line. Validation schema used: {\"type\"=>\"integer\"}.\\nInvalid value '' at path /0/elements/0/steps/2/line. Validation schema used: {\"type\"=>\"integer\"}.\\nInvalid value '' at path /0/elements/0/steps/3/line. Validation schema used: {\"type\"=>\"integer\"}.\\nInvalid value '' at path /0/elements/0/steps/4/line. Validation schema used: {\"type\"=>\"integer\"}.\\nInvalid value '' at path /0/elements/0/steps/5/line. Validation schema used: {\"type\"=>\"integer\"}.\\nInvalid value '' at path /0/elements/0/steps/6/line. Validation schema used: {\"type\"=>\"integer\"}." } [Zephyr Scale] [ERROR] Test Cycle was not created [Zephyr Scale] [ERROR] There was an error while publishing test results to Zephyr Scale and they were not sent. Error details: Error when executing always post condition: java.lang.RuntimeException: There was an error while trying to import files to Jira. Http Status Code: 400 at com.adaptavist.tm4j.jenkins.http.Tm4jJiraRestClient.processUploadingResultsResponse(Tm4jJiraRestClient.java:145) at com.adaptavist.tm4j.jenkins.http.Tm4jJiraRestClient.uploadCucumberFile(Tm4jJiraRestClient.java:51) at com.adaptavist.tm4j.jenkins.extensions.postbuildactions.TestResultPublisher.uploadResultsFile(TestResultPublisher.java:134) at com.adaptavist.tm4j.jenkins.extensions.postbuildactions.TestResultPublisher.validateFieldsAndUploadResults(TestResultPublisher.java:116) at com.adaptavist.tm4j.jenkins.extensions.postbuildactions.TestResultPublisher.publishResults(TestResultPublisher.java:95) Caused: java.lang.RuntimeException at com.adaptavist.tm4j.jenkins.extensions.postbuildactions.TestResultPublisher.handlePublishException(TestResultPublisher.java:107) at com.adaptavist.tm4j.jenkins.extensions.postbuildactions.TestResultPublisher.publishResults(TestResultPublisher.java:97) at com.adaptavist.tm4j.jenkins.extensions.postbuildactions.TestResultPublisher.perform(TestResultPublisher.java:86) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) [Pipeline] }[Pipeline] // stage[Pipeline] }[Pipeline] // withEnv[Pipeline] }[Pipeline] // node[Pipeline] }[Pipeline] // podTemplate[Pipeline] End of Pipelinejava.lang.RuntimeException: There was an error while trying to import files to Jira. Http Status Code: 400 at com.adaptavist.tm4j.jenkins.http.Tm4jJiraRestClient.processUploadingResultsResponse(Tm4jJiraRestClient.java:145) at com.adaptavist.tm4j.jenkins.http.Tm4jJiraRestClient.uploadCucumberFile(Tm4jJiraRestClient.java:51) at com.adaptavist.tm4j.jenkins.extensions.postbuildactions.TestResultPublisher.uploadResultsFile(TestResultPublisher.java:134) at com.adaptavist.tm4j.jenkins.extensions.postbuildactions.TestResultPublisher.validateFieldsAndUploadResults(TestResultPublisher.java:116) at com.adaptavist.tm4j.jenkins.extensions.postbuildactions.TestResultPublisher.publishResults(TestResultPublisher.java:95) Caused: java.lang.RuntimeException at com.adaptavist.tm4j.jenkins.extensions.postbuildactions.TestResultPublisher.handlePublishException(TestResultPublisher.java:107) at com.adaptavist.tm4j.jenkins.extensions.postbuildactions.TestResultPublisher.publishResults(TestResultPublisher.java:97) at com.adaptavist.tm4j.jenkins.extensions.postbuildactions.TestResultPublisher.perform(TestResultPublisher.java:86) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101) at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Finished: FAILURE

 

1 Reply

  • MisterB's avatar
    MisterB
    Champion Level 3

    Hi,

     

    If you want support from the official support team at Smartbear you can contact them here: SmartBear Support

     

    But if it helps, this is what I could glean from Chat GPT...

    Regarding analysis of the error log and JSON code:

    The error log you provided indicates that there are issues with the JSON code being parsed. Here are the key points from the error log:

     

    1. The error message states that there was an error parsing the JSON file located at /var/jenkins_home/jobs/.json.   The error is related to an invalid value in the JSON file. The specific value causing the error is a large JSON object containing information about a scenario.  The error message mentions that the validation schema used to parse the JSON file expects certain properties, such as type, line, and name, to be present. However, some of these properties are missing or have invalid values in the JSON object.  The error log provides specific details about the missing or invalid values for properties like line in different steps of the scenario.  Additionally, there is an error related to publishing test results to Zephyr Scale, which seems to be triggered by the issues in parsing the JSON file. This error prevents the creation of a test cycle.

    Based on the information provided in the error log, it seems that the cause of the error is an issue with the JSON file's structure and missing/invalid values for certain properties. To resolve the error, you need to review the JSON code at /var/jenkins_home/jobs/.json and ensure that it adheres to the expected structure and contains valid values for the required properties.

     

    Regarding the error log:

    The code you provided seems to be an error log or a console output rather than code itself. It appears to be related to publishing test results to Zephyr Scale, a test management tool integrated with Jenkins.

    The error message indicates that there is an issue with parsing a JSON file, specifically /var/jenkins_home/jobs/.json. The error message further provides details about the specific problems encountered while parsing the JSON.

    The main issues mentioned in the error message are:

    1. Invalid value for the key "line" in the JSON. The validation schema expects an integer value but found an empty string ('') instead.

    2. Missing required key "line" in the JSON. The validation schema expects a key called "line" in the JSON, but it is missing.

    These issues are causing the validation of the JSON file to fail, resulting in the overall error. To fix this, you need to review and correct the JSON file at the specified location (/var/jenkins_home/jobs/.json) by ensuring that it adheres to the expected schema and all required keys are present with valid values.