Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integration Testing for a Web App

I want to do full integration testing for a web application. I want to test many things like AJAX, positioning and presence of certain phrases and HTML elements using several browsers. I'm seeking a tool to do such automated testing.

On the other hand; this is my first time using integration testing. Are there any specific recommendations when doing such testing? Any tutorial as well?

(As a note: My backend code is done using Perl, Python and Django.)

Thanks!

like image 587
khelll Avatar asked Nov 17 '09 09:11

khelll


2 Answers

If you need to do full testing including exploiting browser features like AJAX then I would recomend Selenium. Selenium launches a browser and controls it to run the tests.

It supports all the major platforms and browsers. Selenium itself is implemented in Java but that is not really an issue if it is being used to test a web application through its user interface.

Selenium tests are a sequence of commands in an HTML table, the supported commands are in well documented. There is also an IDE implemented as a Firefox plugin that can be used to record and run tests. However the test scripts created in the IDE can be used to drive tests against any of the supported browsers.

like image 194
Tendayi Mawushe Avatar answered Oct 03 '22 08:10

Tendayi Mawushe


Selenium is a good way to go. For using it with Perl then use the Test::WWW::Selenium CPAN module.

Here is one example from its pod:

use WWW::Selenium;

my $sel = WWW::Selenium->new( host => "localhost", 
                              port => 4444, 
                              browser => "*iexplore", 
                              browser_url => "http://www.google.com",
                            );

$sel->start;
$sel->open("http://www.google.com");
$sel->type("q", "hello world");
$sel->click("btnG");
$sel->wait_for_page_to_load(5000);
print $sel->get_title;
$sel->stop;

And here are some additional links which maybe helpful:

  • Selenium + Perl wiki
  • Automating browser activities using Selenium
  • Using WWW::Selenium To Test Or Automate An Ajax Website

/I3az/

like image 30
draegtun Avatar answered Oct 03 '22 07:10

draegtun