Show
Ignore:
Timestamp:
07/23/07 18:01:54 (1 year ago)
Author:
kindlund
Message:

sva: merging branch using tags svn+ssh://kindlund@www.honeyclient.org/home/svn/honeyclient/honeyclient/tags/exp/PRE-kindlund-firefox and svn+ssh://kindlund@www.honeyclient.org/home/svn/honeyclient/honeyclient/branches/exp/kindlund-firefox

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/trunk/t/honeyclient_agent_driver_browser_ie.t

    r131 r751  
    77 
    88 
     9# =begin testing 
     10{ 
     11# Make sure Log::Log4perl loads 
     12BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 
     13        or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly listed within the path."); 
     14        
     15        # Suppress all logging messages, since we need clean output for unit testing. 
     16        Log::Log4perl->init({ 
     17            "log4perl.rootLogger"                               => "DEBUG, Buffer", 
     18            "log4perl.appender.Buffer"                          => "Log::Log4perl::Appender::TestBuffer", 
     19            "log4perl.appender.Buffer.min_level"                => "fatal", 
     20            "log4perl.appender.Buffer.layout"                   => "Log::Log4perl::Layout::PatternLayout", 
     21            "log4perl.appender.Buffer.layout.ConversionPattern" => "%d{yyyy-MM-dd HH:mm:ss} %5p [%M] (%F:%L) - %m%n", 
     22        }); 
     23} 
     24require_ok('Log::Log4perl'); 
     25use Log::Log4perl qw(:easy); 
     26 
     27# Make sure HoneyClient::Util::Config loads. 
     28BEGIN { use_ok('HoneyClient::Util::Config', qw(getVar)) 
     29        or diag("Can't load HoneyClient::Util::Config package.  Check to make sure the package library is correctly listed within the path.");  
     30 
     31        # Suppress all logging messages, since we need clean output for unit testing. 
     32        Log::Log4perl->init({ 
     33            "log4perl.rootLogger"                               => "DEBUG, Buffer", 
     34            "log4perl.appender.Buffer"                          => "Log::Log4perl::Appender::TestBuffer", 
     35            "log4perl.appender.Buffer.min_level"                => "fatal", 
     36            "log4perl.appender.Buffer.layout"                   => "Log::Log4perl::Layout::PatternLayout", 
     37            "log4perl.appender.Buffer.layout.ConversionPattern" => "%d{yyyy-MM-dd HH:mm:ss} %5p [%M] (%F:%L) - %m%n", 
     38        }); 
     39         
     40} 
     41require_ok('HoneyClient::Util::Config'); 
     42can_ok('HoneyClient::Util::Config', 'getVar'); 
     43use HoneyClient::Util::Config qw(getVar); 
     44 
     45# Make sure the module loads properly, with the exportable 
     46# functions shared. 
     47BEGIN { use_ok('HoneyClient::Agent::Driver::Browser::IE') or diag("Can't load HoneyClient::Agent::Driver::Browser::IE package.  Check to make sure the package library is correctly listed within the path."); } 
     48require_ok('HoneyClient::Agent::Driver::Browser::IE'); 
     49can_ok('HoneyClient::Agent::Driver::Browser::IE', 'new'); 
     50can_ok('HoneyClient::Agent::Driver::Browser::IE', 'drive'); 
     51can_ok('HoneyClient::Agent::Driver::Browser::IE', 'isFinished'); 
     52can_ok('HoneyClient::Agent::Driver::Browser::IE', 'next'); 
     53can_ok('HoneyClient::Agent::Driver::Browser::IE', 'status'); 
     54can_ok('HoneyClient::Agent::Driver::Browser::IE', 'getNextLink'); 
     55use HoneyClient::Agent::Driver::Browser::IE; 
     56 
     57# Suppress all logging messages, since we need clean output for unit testing. 
     58Log::Log4perl->init({ 
     59    "log4perl.rootLogger"                               => "DEBUG, Buffer", 
     60    "log4perl.appender.Buffer"                          => "Log::Log4perl::Appender::TestBuffer", 
     61    "log4perl.appender.Buffer.min_level"                => "fatal", 
     62    "log4perl.appender.Buffer.layout"                   => "Log::Log4perl::Layout::PatternLayout", 
     63    "log4perl.appender.Buffer.layout.ConversionPattern" => "%d{yyyy-MM-dd HH:mm:ss} %5p [%M] (%F:%L) - %m%n", 
     64}); 
     65 
     66# Make sure Win32::Job loads. 
     67BEGIN { use_ok('Win32::Job') or diag("Can't load Win32::Job package.  Check to make sure the package library is correctly listed within the path."); } 
     68require_ok('Win32::Job'); 
     69use Win32::Job; 
     70 
     71# Make sure ExtUtils::MakeMaker loads. 
     72BEGIN { use_ok('ExtUtils::MakeMaker', qw(prompt)) or diag("Can't load ExtUtils::MakeMaker package.  Check to make sure the package library is correctly listed within the path."); } 
     73require_ok('ExtUtils::MakeMaker'); 
     74can_ok('ExtUtils::MakeMaker', 'prompt'); 
     75use ExtUtils::MakeMaker qw(prompt); 
     76} 
     77 
     78 
     79 
     80# =begin testing 
     81{ 
     82# Generate a notice, to clarify our assumptions. 
     83diag(""); 
     84diag("About to run basic IE-specific browser tests."); 
     85diag("Note: These tests *require* network connectivity and"); 
     86diag("*expect* IE to be installed at the following location."); 
     87diag(""); 
     88 
     89my $processExec = getVar(name      => "process_exec", 
     90                         namespace => "HoneyClient::Agent::Driver::Browser::IE"); 
     91my $processName = getVar(name      => "process_name", 
     92                         namespace => "HoneyClient::Agent::Driver::Browser::IE"); 
     93 
     94diag("Process Name:\t\t'" . $processName . "'"); 
     95diag("Process Location:\t'" . $processExec . "'"); 
     96diag(""); 
     97diag("If IE is installed in a different location or has a different executable name,"); 
     98diag("then please answer *NO* to the next question and update your etc/honeyclient.xml"); 
     99diag("file, changing the 'process_name' and 'process_exec' elements in the"); 
     100diag("<HoneyClient/><Agent/><Driver/><Browser/><IE/> section."); 
     101diag(""); 
     102diag("Then, once updated, re-run these tests."); 
     103diag(""); 
     104 
     105my $question; 
     106$question = prompt("# Do you want to run these tests?", "yes"); 
     107if ($question !~ /^y.*/i) { 
     108    exit; 
     109} 
     110 
     111my $ie = HoneyClient::Agent::Driver::Browser::IE->new(test => 1); 
     112is($ie->{test}, 1, "new(test => 1)") or diag("The new() call failed."); 
     113isa_ok($ie, 'HoneyClient::Agent::Driver::Browser::IE', "new(test => 1)") or diag("The new() call failed."); 
     114 
     115diag(""); 
     116diag("About to drive IE to a specific website for *exactly* " . $ie->{timeout} . " seconds."); 
     117diag("Note: Please do *NOT* close the browser manually; the test code should close it automatically."); 
     118diag(""); 
     119 
     120$question = prompt("# Which website should IE browse to?", "http://www.google.com"); 
     121$ie->drive(url => $question); 
     122 
     123diag(""); 
     124$question = prompt("# Did IE properly render the page and automatically exit?", "yes"); 
     125if ($question !~ /^y.*/i) { 
     126    diag(""); 
     127    diag("Check your network connectivity and verify that you can manually browse this page in IE."); 
     128    diag("Then, re-run these tests."); 
     129    diag(""); 
     130    diag("If the tests still do not work, please submit a ticket to:"); 
     131    diag("http://www.honeyclient.org/trac/newticket"); 
     132    diag(""); 
     133    fail("The drive() call failed."); 
     134} 
     135} 
    9136 
    10137