Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007078TestLinkBug Tracking System - JIRA Integrationpublic2015-04-23 19:212015-04-26 21:39
Reporterchrijm 
Assigned Tofman 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version1.9.13 (2015 #1) 
Fixed in Version1.9.14 (2015 Q3) 
Summary0007078: Jira Rest causes crash preventing user from seeing execution results (BAD USER CONFIGURATION)
Description1) When Jira Rest Integration is enabled, users can not see test execution results in the right hand pane as expected. Instead, either a blank pane is shown or an HTTP 500 error.

2) Investigation showed a Jira uri being generated with an extra / in it (see addiitonal information) so this might be a case of multiple issues, with this issue highlighting the first one.

Error Log shows:
PHP Fatal error: Cannot use object of type stdClass as array in /bug/shared/htdocs/testlink-1.9.13/lib/issuetrackerintegration/jirarestInterface.class.php on line 471, referer: {our url}/lib/execute/execNavigator.php?setting_testplan=
Steps To ReproduceEnable JIRA Rest Integration on TestProject
Go to Execute Tests and drill down to a previously run test in the tree.
Click on tree item.
You should see test results in the right pane, but instead the right pane will be blank in FireFox or show HTTP 500 error on IE.
Additional InformationAs described in the Testlink error log, the error happens in the private function objectAttrToIDName($obj). This is new code to v1.9.13.

 I was able to determine the function expects an array to be passes in (yet the variable name is $obj for some reason) but in some cases an object is passed in.

When this happens, the code crashes because it only expects an array. I made a quick fix just to handle the case of an object being passed in without crashing, but I didn't investigate why an object was being passed in instead of an array.

In our case the object being passed in, looked to be a 404 error message from the Jira server. The object had a uri in it with the Jira server but had an extra / in the middle (perhpas this extra / cause the 404?).

Object being passed in (notice the extra / between project and component):
object(stdClass)0000510 (2) { ["message"]=> string(88) "null for uri: <jira uriapi value>project//versions" ["status-code"]=> int(404) } object(stdClass)0000510 (2) { ["message"]=> string(90) "null for uri: <jira uriapi value>project//components" ["status-code"]=> int(404) }

Our quick and dirty fix:
  private function objectAttrToIDName($obj)
  {
    $ret = null;
    if(!is_null($obj))
    {
      if(is_array())
      {
        $ic = count($obj);
        for($idx=0; $idx < $ic; $idx++)
        {
          $ret[$obj[$idx]->id] = $obj[$idx]->name;
        }
      }
      else if (is_object($obj))
      {
        $ret[$obj->id] = $obj->name;
      }
    }
    return $ret;
  }
TagsNo tags attached.
Database (MySQL,Postgres,etc)MYSQL
Browser
PHP Version
TestCaseID
QA Team - Task Workflow StatusTBD
Attached Files

- Relationships
related to 0007081closedfman Jira Rest Integration - Better check on mandatory config parameter (projectKey) 
child of 0006830closedfman Availables hot-fixes for 1.9.13 & How To get full fixed package from GitHub 

-  Notes
(0023135)
fman (administrator)
2015-04-23 20:13
edited on: 2015-04-23 20:16

Dear user
1) be sure you are using latest code from github and not 1.9.13 as released (i.e. got from source forge or bitnami)

2) it's very important that you provide detailed steps to reproduce.
what you have already provided is not enough, what is need are step by step that allows me to be sure we are using same scenario.
Give a look to forum for examples of detail requested

Details to reproduce are as much important as code that can fix the issue.

(0023136)
fman (administrator)
2015-04-23 20:22

It's always very important when facing an issue. use fixes present on
http://mantis.testlink.org/view.php?id=6830 [^]

before reporting
(0023142)
chrijm (reporter)
2015-04-23 23:15

1) New to TestLink, wasn't aware that the released version had updates available. I'll give that a try.

2) Only three elements need to happen and I though that was pretty clear with the steps. You need JIRA Rest Integration enabled on a Test Project and then simply attemt to look at the test results of an already executed test. But to be more detailed (forum examples, what forum?):

Setup JIRA Rest
-------------------------------
Goto Issue Tracket Management
Click Create
Set the following values:
Issue Tracker: JIRA
Type: jira (interface: rest)
Configuration:
<!-- Template jirarestInterface -->
<issuetracker>
<username>JIRA LOGIN NAME</username>
<password>JIRA PASSWORD</password>
<uribase>https://JIRA [^] SERVER/</uribase>
<uriapi>https://JIRA [^] SERVER/rest/api/latest/</uriapi>
<uriview>https://JIRA [^] SERVER/browse/</uriview>
<projectkey></projectkey>
<issuetype>7</issuetype>
</issuetracker>

Click Save

Ensure Test Project is using JIRA Rest
--------------------------------------
Goto Test Project Management
Click on an existing Test Project (one that has Test Executions already performed)
Ensure that Issue Tracker Integration has Active checked and Issue Tracker is set to JIRA (jira (interface: rest) )
Click save

Attempt to look at test results
-------------------------------
Goto Execute Tests
Select a Test Plan and build that has tests already executed
Go down to the tree (bottom left pane) with the tests and select one that should have test results. They should show in the right pane, but do not due to the error.
(0023143)
fman (administrator)
2015-04-24 05:32
edited on: 2015-04-24 05:33

You need to give a look to
a) README file present on each TestLink Distribution
b) README file that you can download from sourceforge
c)www.testlink.org => you will find indication about forum there.

if you do not proceed in this way, i need a lot more time (that is not available) to provide support, for things that maybe has been already solved.

>> I though that was pretty clear with the steps
unforntunately this is a very typical error users do again and again, considering that is part of developer team task understand situation without all data needed.
Please avoid this type of comments that adds no useful element to the issue reporting.
Give a look to the issue for guidelines/suggestions.
http://mantis.testlink.org/view.php?id=7042 [^]

Closing waiting for the feedback after fixes applied.

(0023144)
fman (administrator)
2015-04-24 05:33

waiting for user update after fixes
(0023147)
chrijm (reporter)
2015-04-24 18:46

After using the latest checkout (from today) the error still persists, although it shows up in a different place now. The test execution results page now shows, but when you click on the "Create Issue" icon you hit the same error. The popup window that should show the form to add a new bug instead shows the 500 error. The error is is on the same line of code (see log entry below) as previously indicated.

In this case both getVersionsForHTMLSelect() and getComponentsForHTMLSelect() call the objectAttrToIDName() function with an object instead of an array causing objectAttrToIDName() to error.

The call to getVersionsForHTMLSelect() calls $this->getVersions() whichs returns an object that is passed on to objectAttrToIDName(). The object looks like this: object(stdClass)0000463 (2) { ["message"]=> string(88) "null for uri: https://<JIRA [^] SERVER>/jira/rest/api/latest/project//versions" ["status-code"]=> int(404) }

The getComponentsForHTMLSelect() call similary calls $this->getComponents() passing on the object: object(stdClass)0000463 (2) { ["message"]=> string(90) "null for uri: https://<JIRA [^] SERVER>/jira/rest/api/latest/project//components" ["status-code"]=> int(404) }

From Error Log:
[Fri Apr 24 11:27:09 2015] [error] [client 10.100.11.136] PHP Fatal error: Cannot use object of type stdClass as array in /bug/shared/htdocs/testlink-snapshot/lib/issuetrackerintegration/jirarestInterface.class.php on line 499

--- AMENDED "Steps To Reproduce" for latest build ---
...
 Select a Test Plan and build that has tests already executed
 Go down to the tree (bottom left pane) with the tests and select one that should have test results.
 
Attempt to Create Bug
 -------------------------------
 In the right hand pane, click on "Create Issue" icon.
 A new window will pop up.
 It should have aform to create a new bug, but instead shows a HTTP 500 page due to the error.
(0023148)
fman (administrator)
2015-04-25 07:42

If your configuration is really this
<projectkey></projectkey>

is wrong because projectKey is mandatory, and this is origin of all your theories about the double /
(//) in URL.

Best double check configuration before start hacking the code.
(0023152)
fman (administrator)
2015-04-25 13:33

https://github.com/TestLinkOpenSourceTRMS/testlink-code/commit/6b023e4d56bf27be83cf442b5c4a088c225635ea [^]
(0023226)
chrijm (reporter)
2015-04-26 20:52

Indded our configuration does have <projectkey></projectkey>. This has been done intentionally. In previous versions (at least 1.9.10 & 1.9.11) leaving this value blank allowed the user to specify it when linking a bug (they would type in "KEY-1234" instead of just "1234"). That way they could link to various projects in Jira. I believe this did not allow the user to create a new bug.

It's worth mentioning that in an organization with more than a single project, being restricted to a single project key for the entire TestLink world is not practical. Multiple projects means multiple project keys in Jira which means to use TestLink you really need to be able to link to various project keys. This has been mentioned in the forums and I though there was a feature request for it already, but I'm not finding it. Perhaps a new feature request is in order.
(0023227)
fman (administrator)
2015-04-26 21:38

>> Indded our configuration does have <projectkey></projectkey>. This has been done >>intentionally. In previous versions (at least 1.9.10 & 1.9.11) leaving this value blank allowed the >>user to specify it when linking a bug (they would type in "KEY-1234" instead of just "1234"). >>That
>>way they could link to various projects in Jira.
>>I believe this did not allow the user to create a new bug
You have used always a wrong configuration.
Documentation said that you HAVE TO PROVIDE <projectkey></projectkey> if you want to be able to create an issue. This is very different to provide the tags without a value.
When linking you ALWAYS need to provide the COMPLETE issue ID including JIRA PROJECT KEY.
This has been the way this worked in each TestLink version.


>> It's worth mentioning that in an organization with more than a single project, being restricted >> to a single project key for the entire TestLink world is not practical.
This means that you have do not understand how TestLink implementation of issue tracking integration works.
This has been explained (unfortunately not in very clear way) on forum.
If you want to be able to create issues from testlink you have to create a ONE TO ONE relation between ISSUE TRACKER on Testlink and JIRA PROJECT.

>> I though there was a feature request for it already, but I'm not finding it
This means that this feature does not exists, I need facts no guessing.

- Issue History
Date Modified Username Field Change
2015-04-23 19:21 chrijm New Issue
2015-04-23 20:13 fman Note Added: 0023135
2015-04-23 20:16 fman Note Edited: 0023135 View Revisions
2015-04-23 20:18 fman QA Team - Task Workflow Status => TBD
2015-04-23 20:18 fman Additional Information Updated View Revisions
2015-04-23 20:20 fman Status new => feedback
2015-04-23 20:22 fman Note Added: 0023136
2015-04-23 23:15 chrijm Note Added: 0023142
2015-04-23 23:15 chrijm Status feedback => new
2015-04-24 05:32 fman Note Added: 0023143
2015-04-24 05:33 fman Note Edited: 0023143 View Revisions
2015-04-24 05:33 fman Note View State: 0023143: public
2015-04-24 05:33 fman Note Added: 0023144
2015-04-24 05:33 fman Status new => resolved
2015-04-24 05:33 fman Resolution open => unable to reproduce
2015-04-24 05:33 fman Assigned To => fman
2015-04-24 18:46 chrijm Note Added: 0023147
2015-04-24 18:46 chrijm Status resolved => assigned
2015-04-24 18:46 chrijm Resolution unable to reproduce => reopened
2015-04-25 07:42 fman Note Added: 0023148
2015-04-25 08:13 fman Issue cloned: 0007081
2015-04-25 08:13 fman Relationship added related to 0007081
2015-04-25 10:24 fman Summary Jira Rest Integration causes crash preventing user from seeing execution results => Jira Rest causes crash preventing user from seeing execution results (BAD USER CONFIGURATION)
2015-04-25 13:33 fman Note Added: 0023152
2015-04-25 13:33 fman Status assigned => resolved
2015-04-25 13:33 fman Fixed in Version => 1.9.14 (2015 Q3)
2015-04-25 13:33 fman Resolution reopened => fixed
2015-04-25 13:37 fman Relationship added child of 0006830
2015-04-26 20:52 chrijm Note Added: 0023226
2015-04-26 21:38 fman Note Added: 0023227
2015-04-26 21:39 fman Status resolved => closed



Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker