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

Broken Line/File reporting in diagnostic messages #11

Open
2shortplanks opened this issue May 8, 2012 · 0 comments
Open

Broken Line/File reporting in diagnostic messages #11

2shortplanks opened this issue May 8, 2012 · 0 comments

Comments

@2shortplanks
Copy link

When I write a simple script using Test::WWW::Selenium, my line numbers report correctly

travis-5:~ mark$ cat selenium.pl 
#!/usr/bin/env perl

use Test::More tests => 1;
use Test::WWW::Selenium;

my $sel = Test::WWW::Selenium->new(
    browser_url => "http://google.com"
);
$sel->open_ok("http://www.thisserverdoesnotexist.com");

travis-5:~ mark$ perl selenium.pl 
1..1
# Error requesting http://localhost:4444/selenium-server/driver/:
# Timed out after 30000ms
not ok 1 - open, http://www.thisserverdoesnotexist.com
#   Failed test 'open, http://www.thisserverdoesnotexist.com'
#   at selenium.pl line 9.
# Looks like you failed 1 test of 1.

However, when I use ::More, I get broken line numbers

travis-5:~ mark$ cat selenium-more.pl 
#!/usr/bin/env perl

use Test::More tests => 1;
use Test::WWW::Selenium::More;

my $sel = Test::WWW::Selenium::More->new(
    browser_url => "http://google.com"
);
$sel->open_ok("http://www.thisserverdoesnotexist.com");

travis-5:~ mark$ perl selenium-more.pl 
1..1
# Error requesting http://localhost:4444/selenium-server/driver/:
# Timed out after 30000ms
not ok 1 - open, http://www.thisserverdoesnotexist.com
#   Failed test 'open, http://www.thisserverdoesnotexist.com'
#   at /Users/mark/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/darwin-2level/Moose/Meta/Method/Delegation.pm line 110.
# Looks like you failed 1 test of 1.

I've looked at how to fix this myself, and I can't see an easy way. The problem is that you don't know how many calling frames you are away from calling Test::Builder you are (and you can't know, because that's an implmentation detail of the version of Moose you're using) so you can't set $Test::Builder::Level to the right value.

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

1 participant