Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

Customizing Jira-Plugin trouble


#1

Hi all,

After successfully using Testrail for a couple of months I now feel the need for some customisation of the Jira defects plugin to better fit our Jira, but I miserably fail directly at the beginning following this guide:

http://docs.gurock.com/testrail-integration/defects-plugins-examples

I have copied Jira_REST.php to /opt/testrail/custom/defects/Jira_sym.php and changed the class to

class Jira_sym_defect_plugin extends Defect_plugin

The new plugin can be properly selected in the project’s configuration. (It is a test project which is overriding just the defect plugin. Globally I have defined the Jira REST plugin)
When I then go to an existing test run, I get the following error message:

PHP error: Cannot redeclare class Jira_RESTException in /opt/testrail/www/app/plugins/defects/Jira_REST.php at 1874

So I am stuck at the moment and any help is greatly appreciated!

Best,

Ben


#2

Hey Ben,

Just rename the Jira_RESTException class (and references to it) in your custom defect plugin as well and you can find the definition at the bottom of the file. For example, to fit your naming convention, just do a find & replace on Jira_RESTException to Jira_sym_RESTException.

I hope this helps!

Cheers,
Tobias


#3

Hi Tobias,

I have changed the exception declaration. Then, another error turned up:

 PHP error: Cannot redeclare class Jira_REST_api in /opt/testrail/www/app/plugins/defects/Jira_REST.php at 937

I have changed that class name as well, and now it appears to work.

EDIT: Renaming Jira_REST_api was not a good idea. Now, when I open the push defect dialog I get:

PHP error: Class 'Jira_REST_api' not found in /opt/testrail/www/custom/defects/Jira_sym.php at 392

So I am afraid, I need some more help,

Best,

Ben


#4

Hi Ben,

You would need to change all references to the Jira_REST_api class accordingly in your code. E.g. a find & replace in your custom defect plugin just like with Jira_RESTException would do the trick.

Cheers,
Tobias


#5

Hi Tobias,

Ok, I have missed the reference to that class in the plugin code. Now it is really workng :wink:

Thanks a lot,

Ben


#6

Great to hear that, Ben :slight_smile:

Cheers,
Tobias