On Wed, Dec 07, 2005 at 08:01:39PM +0000, Mark Stosberg wrote:
> So I'm now using and liking Selenium after several recommendations from
> this list. I'm interested to know how other people integrate it with a
> traditional perl test suite.  It seems like there are two possibilities:
> 
>  http://selenium.thoughtworks.com/
> 
> 1. Use "prove" as the primary test suite runner, and write some glue to
> have Selenium return results in the standard TAP format.  
> 
> 2. Use Selenium as the primary test suite running, and have a CGI script
> that runs the Perl tests and returns the results to a web page, which
> Selenium then checks, at least for basic failure/success. 
> 
> Before I try to rig up either, is there a standard solution? 
> 
> I see Test::WWW::Selenium, but I can't see how it would work, since my
> test suites all run on headless servers with no JavaScript-enabled
> browsers installed. 
> 
> http://search.cpan.org/~mbarbon/Test-WWW-Selenium-0.01/lib/Test/WWW/Selenium.pm
> 
>     Mark

Hey Mark,

I'm faced with the same task.  Let me first say that my project's test
suite is currently in sad state, but well on the road to recovery.
I'm also not sure how typical my project's environment is from other
perl projects, so I don't know how applicable my suggestions will be.

We've started to use a two phase test approach:

  1. unit test - t/*.t tests
     - make test after building the package
     - mock libraries where possible
     - test results scraped out of build log

  2. system tests - s/*.t tests
     - for testing that must be done on a fully installed, running
       system (web tests, user story tests, integration tests)
     - each package can put system tests in the s/ directory
       - s/ is NOT included as part of the package
       - s/*.t tests output TAP
     - package for system tests
       - pulls in all the s/ tests from the other packages (../*/s/*)
       - puts the tests in etc/tests.d/Package-Name/
     - install some code (the latest build, say)
     - install extra system test package(s)
     - prove each of the package tests in etc/tests.d/*/*
     - results are uploaded to a test result archive service

We have a system that stores the results of all of our builds, and it
shows the results of our unit tests.  I'd like to extend it to also
show the results of the system tests.

So how does Selenium fit into this?

Well, first off, we need to run a real browser somewhere, so lets
imagine a webservice that can run on machines with browsers that can:
  - load a web browser with URL 
  - kill a web browser

Then we need to hook the testing to something.  I could see this
happening either as a 3rd test pass, or as an s/ test.  Infact an s/
test could be pretty cool:

  s/selenium.t:
  - determine application's host:port
  - request a web browser (or several) to test the local selenium URL
    - selenium will automatically begin testing
    - selenium post the test results to a CGI on the local application
    - CGI will convert the results to TAP and write to a local file
  - watch for CGI to write test results file (with timeout)
  - kill the browser we launched
  - print the test results


As I said earlier, I'm not sure how everyone else does integration and
system level testing.  I see lots of intra-package test tools, but I
don't see perl packages for correlating results from many packages, or
for testing above the module level.

I'm also interested in what tools people use for build management,
test result reporting, system testing, but that is a topic for another
day... ;)

Luke


-- 
Luke Closs
PureMessage Developer 
There is always time to juggle in the Sophos Zone.

Reply via email to