Closed Bug 980234 Opened 10 years ago Closed 10 years ago

Testopia : Error message occur "Can't call method "login" on an undefined value"

Categories

(Testopia :: Test Cases, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: singh.satnam, Assigned: LpSolit)

Details

Attachments

(2 files)

Attached image errormessages.jpg
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36

Steps to reproduce:

create test case using testopia.


Actual results:

Error message occur saying "Can't call method "login" on an undefined value""

There was an error loading the data: <h1>Software error:</h1>
<pre>Can't call method &quot;login&quot; on an undefined value at C:/Bugzilla/tr_quicksearch.cgi line 464, &lt;DATA&gt; line 749.
</pre>


Expected results:

No error message should occur.
At this time, Testopia requires not only for QA contact to be enabled, but all components in the product of the test case have a Default QA Contact. While this is understandable behavior, since the QA contact will likely be the tester, both the documentation and the error message itself do little to explain this requirement.
The QA contact should not be mandatory. It has never been, AFAIK. So if Testopia crashes when no QA contact is set, that's a bug.
You get this error with Bugzilla 4.4, because $c->default_qa_contact no longer returns a Bugzilla::User object when no QA contact is defined, see bug 445861. The fix is trivial:

To ssh://gitolite3@git.mozilla.org/bugzilla/extensions/testopia.git
   53032c9..f536f83  master -> master
Assignee: gregaryh → LpSolit
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.6
Attached patch patch, v1Splinter Review
Here is the patch I committed.
when i click "New Case" and select a Plan, click "Use This Test Plan", the error message displayed:

There was an error loading the data: <h1>Software error:</h1>
<pre>Can't call method &quot;login&quot; on an undefined value at /opt/apache/httpd/htdocs/bugzilla/tr_quicksearch.cgi line 463.
</pre>
<p>
For help, please send mail to the webmaster (<a href="mailto:root@localhost">root@localhost</a>), giving this error message 
and the time and date of the error.

</p>

should I use the same patch? how to use the patch?
(In reply to marrial from comment #5)
> should I use the same patch? how to use the patch?

Yes, this should be related to the patch provided in comment 4. If you are using version 2.5 of Testopia, I recommend using the patch as a guideline and manually make the changes yourself (as the patch was written with trunk version in mind), remove the lines denoted with a '-' and adding lines denoted with a '+'. If you are using an earlier version than 2.5, I recommend upgrading first before attempting to manually patch.
It's, OK now, thanks so much. 
one more comment: we should run the checksetup.pl to make the change effect.
I also faced same issue while trying to add a test case in Testopia(I have Testopia 2.5).
As per your instructions, the code slice should be like this:

OLD file: tr_quicksearch.cgi

my $product = Bugzilla::Extension::Testopia::Product->new($product_id);
        
        my @comps;
        foreach my $c (@{$product->components}){
            if ($cgi->param('query')){
                push @comps, {
                    'id' => $c->id, 
                    'name' => $c->name, 
                    'qa_contact' => $c->default_qa_contact->login,
                    'product' => $c->product->name,
                } if ($c->name =~ m/$q/i);
            }
            else {
                push @comps, {
                    'id' => $c->id, 
                    'name' => $c->name, 
                    'qa_contact' => $c->default_qa_contact->login,
                    'product' => $c->product->name,
                };
            }
        }
		
		
After patching:
my $product = Bugzilla::Extension::Testopia::Product->new($product_id);
        
        my @comps;
        foreach my $c (@{$product->components}) {
            if (!$cgi->param('query') || $c->name =~ m/$q/i) {
                 push @comps, {
                     'id' => $c->id, 
                     'name' => $c->name, 
					 'qa_contact' => $c->default_qa_contact ? $c->default_qa_contact->login : '',
					 'product' => $c->product->name,
                };
            }
        }
		
		
------
Could you please confirm whether I have done it correctly or not?

Is this fix available in any released version?

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: