The Selenium-based

testing framework for

people who hate testing

Wouldn't you rather Love Your Tests?

Increase Happiness MAGIUM

Increase Happiness

Magium makes Magento developers happy by structuring tests according to the natural workflow of test development.

Increase Happiness MAGIUM

Reduce Profanity

Magium reduces the frustration of dealing with the intricacies of Magento test automation.

Increase Happiness MAGIUM

Have a well-tested eCommerce website

Magium covers most significant functionality in Magento, with more coverage being added all the time.

MAGIUM INTRODUCTION VIDEO

Getting To Know Magium

If a picture is worth 1,000 words, this video is worth 1,824,000 words.

Turn simple Selenium commands into simpler API calls

In Magium, things that should be simple are simple. This example shows a test that navigates to a product page and then asserts that the product page has the correct title. 3 lines of code are all it takes to get there.


class ProductNavigationTest extends AbstractMagentoTestCase
{

  protected $productName = 'Pearl Stud Earrings';

    public function testNavigateToJewelry()
    {
        $this->commandOpen($this->getTheme()->getBaseUrl());
        $this->getNavigator()->navigateTo($theme->getNavigationPathToProductCategory());
        $this->getNavigator(Product::NAVIGATOR)->navigateTo($this->productName);
        $this->assertTitleContains($this->productName);
    }

}

					

class CustomerCheckoutTest extends AbstractMagentoTestCase
{

    public function testBasicCheckout()
    {
        $this->commandOpen($this->getTheme()->getBaseUrl());
        $addToCart = $this->getAction(AddItemToCart::ACTION);
        $addToCart->addSimpleProductToCartFromCategoryPage();
        $this->setPaymentMethod('CashOnDelivery');
         $customerCheckout= $this->getAction(CustomerCheckout::ACTION);
        $customerCheckout->execute();

        $orderId = $this->getExtractor(OrderId::EXTRACTOR)->getOrderId();
        $this->getNavigator(AccountHome::NAVIGATOR)->navigateTo();
        $this->getNavigator(NavigateToOrder::NAVIGATOR)->navigateTo($orderId);
    }
}

					

Turn crazy-hard Selenium commands into simple API calls

This code adds a product to the cart, checks out as a customer, and navigates to the order on the customer frontend But most Magento tests are somewhat complicated. Magium provides shortcuts that allow you to think in terms of a user's steps, not the commands needed to control a browser.

Build tests that work across multiple different Magento versions

This code builds an initial test and then simply extends the original test, changing the theme configuration Sometimes you need to test against multiple versions of Magento, each with their persnickety-ness. Magium separates function from commands which allows you to re-use a test, switching only the theme that it uses.


class ProductNavigationTest extends AbstractMagentoTestCase
{

    public function testNavigateToCategory()
    {
        $this->commandOpen($this->getTheme()->getBaseUrl());
        $this->getNavigator()->navigateTo($theme->getNavigationPathToProductCategory());
    }
}

// Class extends the original test for testing Magento CE 1.8
class MagentoCE18ProductNavigationTest extends ProductNavigationTest
{
    protected function setUp()
    {
        parent::setUp();
        $this->switchThemeConfiguration('Magium\Magento\Themes\Magento18\ThemeConfiguration');
    }

}

// Class extends the original test for testing Magento EE 1.14
class MagentoEE114ProductNavigationTest extends ProductNavigationTest
{
    protected function setUp()
    {
        parent::setUp();
        $this->switchThemeConfiguration('Magium\Magento\Themes\MagentoEE114\ThemeConfiguration');
    }

}

					

Get Started

Magium is built using PHP and PHPUnit, but if you aren't very familiar with either don't worry, it's actually not that hard. If you are using an IDE (it's probably the best $100 you will spend in a long time) a significant amount of functionality can be built using only minimal PHP coding knowledge.

GET STARTED MAGIUM Download Selenium Server and Chrome WebDriver

01

Download Selenium Server and Chrome WebDriver

Download both the Selenium Server and the Chrome Webdriver binary. While Selenium Server works out of the box with Firefox we have found that Chromedriver is a little more predictable. Both Chrome and Firefox are supported.

Download all files to a common location.

GET STARTED MAGIUM Start Selenium Server

02

Start Selenium Server

Once you have downloaded both components you can Selenium Server using a command similar to this.

java -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium-server-standalone-2.48.2.jar  
GET STARTED MAGIUM Download and install Composer

03

Download and install Composer (or create a new project in your IDE with Composer support)

curl -sS https://getcomposer.org/installer | php 
GET STARTED MAGIUM Add Magium to your project for the software you will be testing

04

Add Magium to your project for the software you will be testing.

Magium tests can be managed either as a distinct project or as a composer-enabled installation of Magento. To install Magium for Magento you will need to issue the following command.

composer require magium/magento

OR

Install the example project for Magento

git clone https://github.com/magium/MagiumMagentoExample

OR

See the blog post on getting started in under 10 minutes

Latest Posts, many useful Examples

Check out the blog for many,
many useful examples.

See All Posts

See what others are saying

Magium Guided Tutorial

MAGIUM GUIDE TUTORIAL