Menu Close
    Start a Project Request quote Reading list Switch to dark mode

    Commands to perform unit testing in Magento 2.

    This blog will aware you about the Execution of the unit tests in Magento 2.
    Before proceeding further let’s get familiar with PHPUnit .
    Here are few wonderful blog links that can help you understand or have Idea faster.

    Hope now you have an Idea about the PHPUnit and Unit testing.

    Today I am going to share the few commands with which you can execute the Unit Testing.
    But ,
    NOTE : The Magento_Developer module must be enabled.
    1. If you want to Execute all the Magento test cases, then use the below command.


    NOTE : But the above commands takes too much time.

    So We need some thing which is faster , so the solution is execute the Unit Tests module wise, so below is a command that can help you with.
    2. If you want to Execute the Unit tests with specific Module :  Ex :- magento-catalog .

    Magento 2 Uses PHPUnit Package to run Unit Tests .
    Basically PHPUnit automation testing framework has been included as a Dependency in Magento 2’s composer.json file.

    Command Format :
    {phpunit_executable} -c {Magentoroot}/dev/test/{type}/phpunit.xml[.dist]  path/to/module/test/dir

    This blog is just to have the hands-on Experience to run test of core module.

    In Next blog we will learn how to create Custom Module’s unit Test in Magento 2.

    . . .


    Add Your Comment

    Be the first to comment.

    Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again