0

In magento 2, I see in so many modules that there are Test/Unit folder available. I know little bit about that it used for unit test purpose.

But, I want to know that :

  • What is the purpose of this folder?
  • Advantage / Disadvantage
  • Actual use

Can any one eloborate in details with example ?

except this links :

0

Unit test case are useful for validate a piece of code. where it is returning expected output or not.lets take following example. In megento we have customer login module. today i wrote some test cases and executed. after some days i have changed some functionality related to customer login module. now i need to check all the scenarios. In that case i go and run all the existing scenarios and check all are valid or not. it means we can validate immediately whatever changed functionality effecting existing scenarios or not. this it main advantage of test cases. we are maintaining set of records to validate particular module/functionality.

lets take login module, by default we have authenticate($username, $password) in AccountManagement.php and test case also available for this authenticate method

Now i added new functionality like login with "username"/"mobile number" or email. instead of only email. now i added test case for newly added functionality. now it is working fine. after that i need to cross verify existing all the scenarios whether is any thing effected of not.

  • 1
    Can you please give me programmatically that example? – Rohan Hapani Jan 30 at 5:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.