Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AnthonyCaliendo/flexunit_puremvc_testcase
A base TestCase which adds PureMVC support to FlexUnit tests for testing Flex/ActionScript projects
https://github.com/AnthonyCaliendo/flexunit_puremvc_testcase
Last synced: about 2 months ago
JSON representation
A base TestCase which adds PureMVC support to FlexUnit tests for testing Flex/ActionScript projects
- Host: GitHub
- URL: https://github.com/AnthonyCaliendo/flexunit_puremvc_testcase
- Owner: AnthonyCaliendo
- License: mit
- Created: 2009-08-28T20:53:03.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2009-08-28T21:02:23.000Z (over 15 years ago)
- Last Synced: 2024-06-23T19:35:52.836Z (7 months ago)
- Language: ActionScript
- Homepage:
- Size: 70.3 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: MIT-LICENSE
Awesome Lists containing this project
- awesome-actionscript-sorted - flexunit_puremvc_testcase - A base TestCase which adds PureMVC support to FlexUnit tests for testing Flex/ActionScript projects (Frameworks / MVC Framework)
README
= PureMvcTestCase
This TestCase class allows testing of PureMVC code through FlexUnit. The style is intended to mirror EventfulTestCase (another extension to FlexUnit).
== Installation
Installation is easy! Just drop the file into an appropriate directory:
1. Create the following directory structure under your flex project:
test/org/puremvc/as3/test
2. Copy the file `PureMvcTestCase.as` into this new directory.
3. Ensure that your compiler settings will look in that directory.You should now be able to import PureMvcTestCase into your test classes.
== How do I use it?
When creating your test class, have it extend PureMvcTestCase.
Here are the methods which are made available:
* expectNotification(notificationName:String)
Sets up the expectation that a notification is sent with the passed name. Can be called multiple times to set the expectation for multiple notifications.
* assertExpectedNotificationsOccurred(userMessage='')
Asserts that all expected notifications were sent. The userMessage parameter indicates an optional message to be prepended for a failure message.
* lastActualNotification
Property which represents the last notification which was sent (the last actual notification).== Example Test Class
The following is an example of the kind of test you can write:
public class ChuckProxyTest extends PureMvcTestCase
{
private var chuck:ChuckProxy = new ChuckProxy();
public function testShouldSendFlashNotificationWhenSeeingTerrorist():void
{
var terrorist:Terrorist = new Terrorist();
expectNotification(ApplicationFacade.FLASHED);
chuck.lookAt(terrorist);
// asserts FLASHED notification was sent
assertExpectedNotificationsOccurred();
// asserts notification body was the terrorist
assertEquals(terrorist, lastActualNotification.getBody());
}
}