Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending report to TestRail failed TypeError: Cannot read property 'replace' of null #15

Open
moonvi opened this issue Nov 16, 2020 · 6 comments

Comments

@moonvi
Copy link

moonvi commented Nov 16, 2020

I've met with the mapping problem when sending tests results to existing run using env.TESTRAIL_RUN_ID
Previous runs have been passed successfully to TestRail but starts failing when I added new parameters to TeamCity:

  • env.TESTRAIL_RUN_ID
  • env.TESTRAIL_UPDATE_RUN_TEST_CASES
  • env.TESTRAIL_UPLOAD_SCREENSHOTS

Full configuration:

TEST_CONFIGURATION = smoke-all-dev

Name Value passed to build
env.TESTRAIL_API_KEY ******
env.TESTRAIL_ENABLED true
env.TESTRAIL_HOST ******
env.TESTRAIL_PROJECT_ID P1
env.TESTRAIL_RUN_ID R194
env.TESTRAIL_RUN_NAME Web E2E Tests (%%DATE%%, %TEST_CONFIGURATION%build%build.number%)
env.TESTRAIL_SUITE_ID S57
env.TESTRAIL_UPDATE_RUN_TEST_CASES false
env.TESTRAIL_UPLOAD_SCREENSHOTS true
env.TESTRAIL_USER ******

So the results not posted to TestRail and gives an error:

[12:55:11][TestRail] Sending report to TestRail failed TypeError: Cannot read property 'replace' of null
[12:55:11] at prepareRun (...\testcafe\node_modules\testcafe-reporter-testrail\lib\index.js:90:50)
[12:55:11] at runMicrotasks ()
[12:55:11] at processTicksAndRejections (internal/process/task_queues.js:97:5)
[12:55:11] at ReporterPluginHost.TestcafeTestrailReporter.reportTaskDone (...\testcafe\node_modules\testcafe-reporter-testrail\lib\index.js:204:35)
[12:55:11] at Reporter.dispatchToPlugin (...\testcafe\node_modules\testcafe\src\reporter\index.js:199:13)
[12:55:11] at Reporter._onceTaskDoneHandler (...\testcafe\node_modules\testcafe\src\reporter\index.js:326:9)
[12:55:11] at ...\testcafe\node_modules\testcafe\src\reporter\index.js:352:39
[12:55:11] at async Promise.all (index 1)
[12:55:11]npm ERR! code ELIFECYCLE
[12:55:11]npm ERR! errno 1
[12:55:11]npm ERR! Exit status 1

NOTE:
Due to confidential info I replaced some data in env params to ******, and to ... in error details.
testcafe: 1.10.0-rc.1
testcafe-reporter-testrail: 0.6.2

TestRail has the following hierarchy:

  • Test Plan R193 with name = TeamCity updates and contains 2 runs:
    -- Test Run R194 with name = Smoke (contains tests from Suite S57 in Project P1)
    -- Test Run R195 with name = Basic Regression (contains tests from Suite S1 in Project P1)

I note that runs cannot be edited inside test plans even my user has all admin write/edit permissions. But the same issue when just 1 run created when run can be edited.

Could you please help with that?


UPD:

  1. The problem was in run description. It wasn't defined in TestRail. By default it is null.
  2. Based on my hierarchy (Test Run inside Test Plan) TestRail api gives the second issue:
[TestRail] Sending report to TestRail failed {
  url: '.../index.php?/api/v2/update_run/194',
  status: 403,
  message: {
    error: 'Field :run_id is part of a test run. Please use API endpoints for test plan entries.'
  }
}
@DamianOsipiuk
Copy link
Owner

@moonvi Hello and thanks for the report.

The first issue with the description being null is indeed not being handled gracefully. I will provide a fix for that shortly so it would not be na issue in the future.

As for the second issue, it is not supported currently, as there is an different endpoint to update test runs that are part of test plans. It will require additional TESTRAIL_PLAN_ID configuration entry.

Until support for this will be added you can use test runs that are outside of test plans.

@moonvi
Copy link
Author

moonvi commented Nov 17, 2020

@DamianOsipiuk Thank you!

About 2nd issue: sure, it's okay to use separate run for me now but would be nice to have TESTRAIL_PLAN_ID in future.

Many thanks

@moonvi
Copy link
Author

moonvi commented Dec 16, 2020

Hi @DamianOsipiuk
Did you have a chance to look at the 1st issue with null ?

@DamianOsipiuk
Copy link
Owner

@moonvi Hi, I've released version 0.6.3 which should solve your issue with null description.

As for the plans support, i'm still waiting for TestRail team answer about API endpoint that is not working as intended.

@moonvi
Copy link
Author

moonvi commented Dec 17, 2020

@DamianOsipiuk Many thanks!

@moonvi
Copy link
Author

moonvi commented Dec 24, 2020

@moonvi Hi, I've released version 0.6.3 which should solve your issue with null description.

As for the plans support, i'm still waiting for TestRail team answer about API endpoint that is not working as intended.

Hi, @DamianOsipiuk
The issue with null description is resolved - results have been passed to TestRail but undefined is added to the Test Run without description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants