Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 766

All questions related to testing Magento: manual testing, automated testing, unit tests, integration tests, functional tests, static analysis, load test, ...

14 votes

Tools for Unit Testing in Magento

Check out PHPSpec with MageSpec if you want something not based on PHPUnit, but with some Magento Integration. Its usable, but not just quite ready for prime time. For mocking PHPSpec 2 uses Prophecy …
Vinai's user avatar
  • 14.1k
16 votes
Accepted

Unit testing source models

This is especially true for developers who still consider themselves learning testing. … Testing the exact return value. This will be a very rigid test that will have to be adjusted to every change. …
Vinai's user avatar
  • 14.1k
16 votes

Best practice for unit tests in Magento 1.9

Installation Since Magento 1 doesn't use composer out of the box, I don't think it makes a big difference if you install phpunit using composer or just download the phar version. If you already use c …
Vinai's user avatar
  • 14.1k
5 votes

Run Integration/Functional Tests on an Existing Database for Customer Specific Projects

In the following response I'll focus on integration testing, since I think that is where the most value lies. For MFTF or legacy functional tests I can't give any recommendations. …
Vinai's user avatar
  • 14.1k
11 votes
Accepted

Magento 2: Fixing Call to Undefined Method Mock_BlockFactory_4b440480::create() Test Failures

The \Magento\Framework\TestFramework\Unit\Helper\ObjectManager isn't able to automatically create a factory mock. (On a side note, I never use the \Magento\Framework\TestFramework\Unit\Helper\ObjectMa …
Vinai's user avatar
  • 14.1k
2 votes
Accepted

Magento 2 integration test in admin context

I think the assumption that the admin store is always active in the adminhtml scope might no longer be true in Magento 2. I have not found any constant with an admin store ID of zero anywhere. Probabl …
Vinai's user avatar
  • 14.1k
4 votes
Accepted

Magento 1: proper way to use transaction begin and rollback

I would have to see the code you are using. All DB operations that do not change the structure of tables (so no DDL methods) are allowed in a transaction. All I can offer is the following example o …
Vinai's user avatar
  • 14.1k
4 votes

Magento 2: how to use the CommandTester

You are not getting the real behavior because the \Magento\Framework\TestFramework\Unit\Helper\ObjectManager creates a mock for each constructor argument dependency, not the real thing. The CommandTes …
Vinai's user avatar
  • 14.1k
6 votes
Accepted

Unit Test or Integration Test for this kind of functions?

In addition to @raphael-at-digital-pianism's great response. I find the resolve method rather complex, so I would want test coverage. $inputParams = $this->serviceInputProcessor->process( \Mage …
Vinai's user avatar
  • 14.1k