Turn your manual testers into automation experts Request a DemoStart testRigor Free

Joomla Testing

Joomla is a Content Management System (CMS) using which you can create your own website. It is open source and uses a graphical user interface to allow its users to design their applications. You can consider it a lightweight PHP framework that allows you to write code in PHP.

Like any other website, Joomla-based websites also need to be tested. Let's take a look at how you can test them using the following:
  • Unit testing
  • Integration testing
  • End-to-End testing

Joomla Unit Testing

Various functions, methods, and classes can be verified using unit testing. It tests units of code in isolation. Joomla utilizes the PHPUnit framework to support unit testing. The correct approach is to ensure that there's exactly one test per method, making it much easier to debug. Another piece of advice is to extend your test class from TestCase, vs. using the default PHPUnit_Framework_Testcase.

For example, consider the below class that needs to be tested.

<?php
  class Foo {
    public function bar($string) {
      if (is_int($string)) {
        return false;
      }
  
      $string = strtoupper($string);
  
      return $string;
    }
  }

Since unit tests assert a valid outcome, below is an example of a unit test for the above class.

<?php
  class FooTest extends TestCase {
    public function testBar1() {
      $object = new foo();
  
      $this->assertEquals('EXAMPLE', $object->bar('example'));
    }
  
    public function testBar2() {
      $object = new foo();
  
      $this->assertEquals(false, $object->bar(4));
    }
  }

You can find in-depth documentation on how to write and run these test cases here.

Joomla Integration Testing

Integration tests help ensure that various units of code are working together harmoniously. Integration testing is applicable to APIs, forms, and database interactions. Examples include integration with a third-party system or an API. The main types that you might be interested in building the tests for are:
  • HTTP tests to test APIs
  • Third-party integration tests
  • System tests (although you might want to prefer them to be a part of end-to-end tests)

You can find more information on Joomla integration testing here.

When it comes to testing Joomla exceptions, Codeception is typically the preferred option. It's designed to work out of the box and doesn't require any pre-installed external dependencies except PHP.

Joomla End-to-End Testing

Functional tests are meant to cover entire flows, not just bits and pieces of code. They can be done using the following:
  • Joomla provided system testing
  • Selenium Webdriver
  • testRigor

Joomla System Testing

Joomla provides libraries to write system tests using Selenium IDE. Using this, you can perform web testing. However, this method is not as versatile and does not cover many everyday use cases that occur on CMS websites.

For further information on system testing, refer to here.

Selenium Webdriver

Selenium is perhaps the most commonly used when it comes to system testing. It's open-source and has a large community around it. Unfortunately, many companies learned about its downsides the hard way. You can read more about Selenium here, and about its main limitations here.

testRigor for Joomla End-to-End Testing

testRigor is a cross-platform tool specifically designed for comprehensive end-to-end testing. First of all, it is extremely easy to use due to being completely no-code; whether you're using a record-and-playback tool, or writing tests from scratch. Second,it's an ideal option for end-to-end testing because it can cover entire user flows, and do so from an actual human's perspective. This means no implementation details will be included as a part of the test, and any elements on the screen are described just as you see them. You can read more about testRigor here.

Here's an example of a test case written in testRigor:
login as manager
click "Schedule"
click 2nd button to the right of  "My posts"
click "Schedule last post" if exists
check that screen contains "Scheduled"

Due to its stability, low test maintenance, and easy test case creation, it is well-equipped to guard the quality of your website. Moreover, CMSs often require testing use cases that involve sending emails or SMS alerts. These are possible to automate using testRigor. Since this is a cloud-based application, it is easy to get started with automation without worrying about installing and setting up software. Further benefits of using testRigor can be seen here.

Conclusion

There's no single most important type of testing, and it's necessary to consider multiple choices to form the best approach. We hope this article will help you do just that.

Join the next wave of functional testing now.
A testRigor specialist will walk you through our platform with a custom demo.