Qafoo GmbH - passion for software quality ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Author: Kore Nordmann :Date: Mon, 18 Nov 2013 10:04:28 +0100 :Revision: 4 :Copyright: All rights reserved ==================================== Shopware Academy: Functional Testing ==================================== :Description: Implementing a strategy for automatic testing inside a pre-existing shop-system such as Shopware requires knowledge of the internals and a tailored approach. This post discusses approaches for Shopware and a workshop that Manuel is presenting at Shopware Academy. :Keywords: PHP, Shopware, Symfony, Functional Testing, Shopware Academy :Abstract: Implementing a strategy for automatic testing inside a pre-existing shop-system such as Shopware requires knowledge of the internals and a tailored approach. This post discusses approaches for Shopware and a workshop that Manuel is presenting at Shopware Academy. Shopware is based on a custom framework that utilizes some Zend Framework 1 and Symfony 2 components. Writing automatic tests within this pre-existing infrastructure makes it neccessary to obtain a dedicated skillset within this system. This applies to any othe rend-user software like Wordpress, TYPO3, ezPublish or phpBB. .. note:: Learn how to automate testing for Shopware plugins and applications by attending the `Shopware Academy`__ workshop by our trainer Manuel. __ http://www.shopware.de/functional-testing-workshop-m-pichler/?sCategory=388 To test the full stack, the software has to be installed on the development- and the testsystem. The full stack includes all the required configuration and database content. In the case of Shopware significant parts of the configuration are saved in the database. Before writing the first tests you have to automate the setup of your application including the configuration for the database. This setup has to mirror your production system as close as possible and you need to make sure that changes to the production setup are also ported to your testing setup. As a next step, you will need to find out how to write your first functional test. There are two recommendable approaches: 1. Using a frontend testing tool such as `Mink`__. This is basically a programmatic API to control a browser, which supports both headless or real browser testing. Mink can be used through the popular testing tools `Behat`__ or `PHPUnit`__. This has the benefit that you don't need to understand most of the internals of Shopware and can just click through your shop application and test features. One drawback however is, that Shopwares ExtJS backend is so dynamic that it is not testable with this approach. __ http://mink.behat.org __ http://behat.org __ http://www.phpunit.de 2. Replicating the functional testing strategy of Shopware by using the test infrastructure that already exists. To test the REST API and the internal APIs Shopware contains several `PHPUnit`__ testcases that help you setting up tests and isolating them from each other. The benefit here is that Shopware already includes this functionality and you can learn how it works and reuse it. The drawback is that not everything can be easily tested through these APIs. Sometimes it is tricky to set these tests up. __ http://www.phpunit.de In any case, writing the first test often requires a bit of setup and knowledge, but quickly pays back when you can build on this knowledge to automate many tests for your application. If you are interested in strategies for testing Shopware plugins or applications you should take a look at this `one-day workshop at the Shopware Academy`__ presented by our trainer Manuel. The workshop will include many theoretical and practical sessions, where you can learn to write functional tests for Shopware. __ http://www.shopware.de/functional-testing-workshop-m-pichler/?sCategory=388 Trackbacks ========== Comments ========