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

Jira integration


#1

I’ve managed to setup the Jira integration - everything’s working fine.
But it’s actually working too good :o

I have the followeing issues.

  • when pushing the “push” link in the test TestRail result window a pop up appears, from which I have to select all the values needed for Jira.
    It happens, that I can select from e.g. from all the projects that are listed in jira. For organizational and user role reasons, I’d like to restrict e.g. the jira projects from which a user can choose

  • I also would like to send the defect as a “SubIssue” (for reporting reasons in jira). But sending an SubIssue requires an ParentIssue, which should be able to select in TR. Any ideas for the problem ?

Keep up the good work !


#2

ok, managed to do the first step (limit the available projects).
I edited the Jira_REST.php as following

public function get_projects()
    {
        $response = $this->_send_command('GET', 'project');
        
        if (!$response)
        {
            return array();
        }
        
        $result = array();
        $expectedProjects = array("Projektname1", "Projektname2", "Projektname3");
        foreach ($response as $project)
        {
            $projectname = (string) $project->name;
            if(in_array($projectname, $expectedProjects)) {
                $p = obj::create();
                $p->id = (string) $project->key;
                $p->name = (string) $project->name;
                $result[] = $p;
            }
        }
        
        return $result;
    }

Still struggling with the second step


#3

ok…have a solution to everything now. :smiley:
So, I’m pushing SubIssues linked to a parent issue in Jira.
Pls. let me know if this of any interest to anyone, and I will publish the code snippets


#4

Hello,

Sorry, I missed this post somehow. Good to hear that you got it working in the meantime. The basic idea for the sub-issues is to add an additional field to the Push Defect dialog to select the parent issue and then modify the push routine to attach the issue to the selected parent (if set).

Regards,
Tobias


#5

yes - i hardcoded it in the PHP file.
So when I select a certain jira project in the push dialog, the parent issue is already known.
So if for some reason (e.g. another project within TestRail) I “just” need to copy the JIRA_Rest.php, change the hardcoded parent issue, and then select this interface (e.g. JIRA_Rest_Projectname.php) in the Administration->Integration section in TestRail.

Probably not the best way, but works for me so far;)


#6

Okay, this would work as well, of course. Using a field for selecting the parent issue would be a bit more flexible but hard-coding it for each project should do the trick as well.

Regards,
Tobias