Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento test automation framework testcase creation

Tags:

magento

I'm using this is my custom testcase in magento test automation framework.

public function test_WithInvalidPassword($wrongPasswords, $errorMessage) {

    //Data
    $userData = $this->loadData('generic_admin_user', $wrongPasswords, array('email', 'user_name'));
    //Steps
    $this->adminUserHelper()->createAdminUser($userData);
    //Verifying
    $this->assertTrue($this->errorMessage($errorMessage), $this->messages);
    $this->assertTrue($this->verifyMessagesCount(), $this->messages);
}


public function data_invalidPassword()
{
    return array(
        array(array(
                'password' => '1234567890',
                'password_confirmation' => '1234567890',
            ), 'invalid_password')
    );
}

Here, it showing me the error like "SystemStores_CreateTest::test_WithInvalidPassword() Missing argument 1 for SystemStores_CreateTest::test_WithInvalidPassword()" and the same functionality is working in the default mtaf-testcases.

can any one suggest for it.

like image 885
Jenish Patel Avatar asked Dec 04 '25 17:12

Jenish Patel


1 Answers

You need to set up a data provider to supply the values for the arguments.

You would need to add the @dataProvider annotation to the docblock comment for the test function.

You can find more information on this page: ecomdev.org/2011/02/01/phpunit-and-magento-yes-you-can.html under the heading 'Data Providers'.

There's also some information in the PHPUnit manual at: http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers.

like image 73
Luke Mills Avatar answered Dec 06 '25 14:12

Luke Mills