Need Acceptance Tests on Magento? you can do it with Fitnesse very quick, clean and easy, just follow the next steps.
- The requirement to get Fitnesse working it's only the JAVA runtimes.
- Dowload the fitnesse.jar and phpslim.phar:
http://fitnesse.org/FrontPage.FitNesseDevelopment.DownLoad
http://ggramlich.github.com/phpslim/installation.html
- Create fitnesse folder on WAMP (or on your server folder) and copy the files:
c:\wamp\bin\fitnesse\fitnesse.jar
c:\wamp\bin\fitnesse\phpslim.phar
- Go to your project folder, create the tests folders and the classes files:
e:\your_magento_folder\_acceptance_tests\execTests.bat
e:\your_magento_folder\_acceptance_tests\MagentoAcceptance\MagentoApp.php
e:\your_magento_folder\_acceptance_tests\MagentoAcceptance\MageFit\Bootstrap.php
- Edit the execTests.bat and save:
java -jar c:\wamp\bin\fitnesse\fitnesse.jar -e 0 -p 8077 -d e:\your_magento_folder\_acceptance_tests\
- Open a prompt and go to:
e:\your_magento_folder\_acceptance_tests\
- Execute:
execTests.bat
VERY IMPORTANT: DO NOT CLOSE THIS PROMPT!, HERE YOU WILL LET THE FITNESSE SERVER RUNNING.
- Browse:
http://localhost:8077/root
- Edit and save:
!define TEST_RUNNER {c:\wamp\bin\fitnesse\phpslim.phar}
!path e:\your_magento_folder\_acceptance_tests\MagentoAcceptance
!define TEST_SYSTEM {slim}
!define COMMAND_PATTERN (php %m e:\your_magento_folder\_acceptance_tests\MagentoAcceptance)
!define PATH_SEPARATOR {:}
!define SLIM_VERSION {0.2}
[[Magento App Test][MagentoApp]]
- Browse:
http://localhost:8077/MagentoApp
- Edit and save:
Magento App Suit
!contents -R2 -g -p -f -h
- Go to Properties.
- Select "Suite" and click on "Save properties".
- Click on "Add child".
- Create the SetUp to get the Boostrap to work.
- Name: SetUp
- Content: !contents
- Click on "Set Up", edit it, replace contents with:
!|Import|
|MageFit|
|script|
|start|bootstrap|
- Save it.
- On the top click on "MagentoApp" and add a new child:
- Type: Test
- Name: MagentoAppTest
- Click on "MagentoAppTest", edit it, replace contents with:
|magento app|
|can call magento?|
|yes|
- The tests on Fitnesse are ready, now we must complete the PHP files.
- Edit e:\your_magento_folder\_acceptance_tests\MagentoAcceptance\MagentoApp.php:
<?php
class MagentoApp
{
public function canCallMagento()
{
if(Mage::app())
{
return 'yes';
}
}
}
?>
- Edit e:\your_magento_folder\_acceptance_tests\MagentoAcceptance\MageFit\Bootstrap.php:
<?php
class MageFit_Bootstrap {
function __construct() {
$mageFilename = 'e:/your_magento_folder/app/Mage.php';
if (!file_exists($mageFilename)) {
echo $mageFilename . " was not found";
exit;
}
require_once $mageFilename;
Mage::app();
}
}
?>
- ALL DONE! CLICK ON "TEST" AND SEE THE MAGIC.
Add comment