Menu Close
    Hire us Request quote Reading list Switch to dark mode
    lockdownWebkulUp

    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.
    -> https://webkul.com/blog/phpunit-basic-tutorial/
    -> https://webkul.com/blog/writing-tests-for-phpunit/

    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.


    OR


    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 .

    . . .
    Subscribe Articles

    Just enter your email below to subscribe and receive weekly updates about the most interesting similar articles.

    You need to accept conditions to receive letters.
    You've Subscribed!

    Share article via

    . . .


    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.

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    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
    Close