 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Stuart Herbert's Blog: PHPUnit Plugin For Sublime Text 2
by Chris Cornutt February 06, 2012 @ 10:05:11
Stuart Herbert has officially released a plugin for the popular text editor Sublime Text 2 to integrate PHPUnit support directly into the editing environment.
Sublime Text 2 is a new cross-platform text editor that I've recently switched to. It's still in public beta, but already offers better performance (and battery life!) and a better look (fonts that render properly!) than Java-based IDEs such as Netbeans. One thing it didn't have was support for PHPUnit, so I've made a plugin. It's available to install via Package Control.
The plugin allows you to directly create tests for a class using a context menu's "Test This Class" option. You can also run the tests directly from the editor and use either the menu or direct text commands to control it. He's also gathering some other well-used PHP snippets into another related plugin, the Additional PHP Snippets plugin.
voice your opinion now!
sublimetext2 editor phpunit plugin additional snippets
Mike Purcell's Blog: PHPUnit - How to Run PHPUnit Against a Specific Test
by Chris Cornutt February 01, 2012 @ 08:37:03
Mike Purcell has a quick new post to his blog showing how you can run PHPUnit on one specific test using handy grouping functionality already built into the tool.
The other day I was debugging an error in one of my unit tests, and found it hard to track down because when I ran PHPUnit, it ran all the tests contained in the file where my problem unit test was located. After some Googling and reading the PHPUnit Api Docs, I found that you can specify a test, among other tests, by adding a comment with the @group annotation.
Using this "@group" annotation tells PHPUnit to combine these tests and allows you you specify a "--group" setting on the command line to only run those. He includes some sample code showing how it can be used. This can be very useful for combining results for certain kinds of tests (say, all related to bugfixes) without having to run everything all over again.
voice your opinion now!
phpunit specific test group annotation
Mike Purcell's Blog: Use PHPUnit without PEAR
by Chris Cornutt January 26, 2012 @ 09:48:00
Mike Purcell has a new post to his blog showing a method he's followed to be able to use the popular PHPUnit unit testing software without having to go through the PEAR installer to get there.
PHPUnit is a great tool to protect us developers from introducing new defects when adding new features or re-factoring code. However there is one HUGE downside to PHPUnit; it must be installed using PEAR. Personally, I don't like 'auto-installers', I'd prefer to know what exactly is happening behind the scenes with regards to which libraries are required and how they are being called. [...] After breaking down the PHPUnit source code, I realized it could be installed without going through PEAR, and without too much headache.
He walks you through the directories you'll need to set up (test/vendor), the commands you'll need to get the latest version and unpack it, changes to set up some symlinks and updating the PHPUnit source to modify the autoloader, bootstrap and phpunit executable.
voice your opinion now!
pear phpunit without installer autoinstall package management
DZone.com: PHPUnit_Selenium
by Chris Cornutt January 20, 2012 @ 09:12:18
On DZone.com today Giorgio Sironi has a quick tutorial showing you how to set up and use the PHPUnit_Selenium component in the latest releases of the popular testing software.
With the 1.2 release, PHPUnit_Selenium supports (basically) for the first time the Selenium 2 WebDriver API. While PHPUnit_Selenium already worked with Selenium 2, it did so only by using the Selenium 1 emulation included in the jar; now it provides an object-oriented API right natively supported in a base PHPUnit test case, shipped in PHPUnit's PEAR channel.
He includes the steps you'll need to pull it from the PEAR channel and how to set up a test case based on the PHPUnit_Extensions_Selenium2TestCase object. He gives a few examples of how to select various components on the page (via CSS selectors and XPath), assert that the right information is there and interact with forms.
voice your opinion now!
phpunit selenium install unittest tutorial example select interact
Chris Hartjes' Blog: PHPUnit Aborted Fix
by Chris Cornutt January 19, 2012 @ 11:16:53
Chris Hartjes ran into an issue with hit unit tests where PHPUnit was throwing an "aborted" error no matter what tests were run. Thankfully, in this new post, he shares a solution.
That was a pretty annoying bug. I never did find out what the problem was as I moved onto other problems and chalked that error up to some undiagnosed weirdness on that particular server. From time to time I would get asked on Twitter if I had ever solved the problem. My answer was always "no, and if you do solve it please let met know how you fixed it." Today, my friends, was the day.
Based on a response from Demian Katz, he was able to get around the issue with flag set on the PHPUnit command line - "-dzend.enable_gc=0". Apparently the issue has to do with garbage collection and has been a known issue since the beginning of 2011.
voice your opinion now!
phpunit aborted unittest fix garbage collection bug
DZone.com: Open/Closed Principle on real world code
by Chris Cornutt January 13, 2012 @ 09:05:53
In a new post to DZone.com Giorgio Sironi talks about the "open/closed principle" in software development and shows an example based on the design of the PHPUnit_Selenium project.
This article shows an example of how the application of the Open/Closed Principle improved the design of a real project, the open source library PHPUnit_Selenium. These design concepts apply to every object-oriented language, including Java, Ruby or even C++. The Open Closed Principle, part of SOLID set, states that software should be open for extension and at the same time closed for modification.
He starts with a little background on the project, pointing out that there's a Session object it uses for all of its testing with a magic "__call" method that handles any kind of method call to the object. This method has issues (dependencies, strict requirements for use) but can be refactored according to the Open/Closed idea to set up an array of anonymous functions that can be called as a "command". Examples of these types of classes are also included (one for the "click" action on a button and another for getting the current location).
voice your opinion now!
open closed principle solid design command phpunit selenium
Brian Swan's Blog: Automating PHPUnit Tests in Windows Azure
by Chris Cornutt January 05, 2012 @ 11:58:46
Brian Swan has posted another tutorial in a series looking at testing applications on the Azure platform. In this latest post he talks about how to automate your PHPUnit tests as a part of the start up of the instance.
In this post, I'll show you how to deploy your PHPUnit tests with your application, have the tests run as a start up task, and have the results written to your storage account for analysis. Attached to this post is a .zip file that contains a skeleton project that you can use to automatically run PHPUnit tests when you deploy a PHP application to Azure. I'll walk you though how to use the skeleton project, then provide a bit more detail as to how it all works (so you can make modifications where necessary).
He has it broken up into a few easy-to-follow steps:
- Download the AzurePHPWebRole zip archive and unpack it
- Copy your application, tests and PHP installation into the resulting file structure
- Create a skeleton "ServiceConfiguration.cscfg" file with the "cspack" command and edit it to change the "osfamily" and "osversion" settings
- Use "cspack" to package up the application and deploy the application
He walks you through the "how it works" steps too - the things that happen for you automatically on the server side to do things like set up the file to log to, configure the PHP environment and execute the "runtests" Powershell file as included in the AzurePHPWebRole download.
voice your opinion now!
automate test phpunit windows azure deploy automatic tutorial
Brian Swan's Blog: Running PHPUnit in Windows Azure
by Chris Cornutt December 09, 2011 @ 10:08:47
Brian Swan has a recent post to his MSDN blog about setting up PHPUnit for testing on a Windows Azure platform (as installed via PEAR).
After figuring out how to run PHPUnit from the command line in a Windows Azure instance, I did find that a bit more configuration work than I anticipated was necessary. I'm not 100% certain that this is the best way to run PHPUnit in Windows Azure, but it is one way. I'd be interested in hearing better ways to do this.
He breaks it up into a few different steps:
- Building the application with your tests locally
- Package the application up for Azure deployment
- Enable RDP access on your Azure instance
- Find your PHP and PEAR install on your instance and, logged in via RDP, add their locations to your current path
- Edit the phpunit.bat file to point to the right PHP location
- Execute the tests!
For other options for testing Azure-based applications, see Brian's previous post.
voice your opinion now!
phpunit windows azure unittest rdp
|
Community Events
Don't see your event here? Let us know!
|