├── Cuke4AS3 ├── README ├── assets │ ├── flexunit │ │ ├── flexunit-4.1.0-8-as3_4.1.0.16076.swc │ │ ├── flexunit_0.9.swc │ │ └── hamcrest-as3-flex-1.1.3.swc │ └── icons │ │ ├── icon-16.png │ │ ├── icon-32.png │ │ └── icon-48.png ├── cuke4as3-build.properties ├── cuke4as3-build.xml ├── libs │ ├── DConsole2SWC.swc │ ├── as3commons-bytecode-1.0.swc │ ├── as3commons-lang-0.3.4.swc │ ├── as3commons-logging-2.6.swc │ ├── as3commons-reflect-1.5.swc │ ├── as3corelib.swc │ ├── flexUnitTasks-4.1.0-33.jar │ ├── flexunit-4.1.0-x-as3_y.y.y.y.swc │ ├── flexunit-cilistener-4.1.0-33-3.5.0.12683.swc │ ├── flexunit-uilistener-4.1.0-33-3.5.0.12683.swc │ ├── flexunit_0.9.swc │ └── hamcrest-as3-flex-1.1.3.swc ├── src │ ├── Cuke4AS3-app.xml │ └── com │ │ └── flashquartermaster │ │ └── cuke4as3 │ │ ├── Config.as │ │ ├── Cuke4AS3.as │ │ ├── events │ │ ├── InvokeMethodEvent.as │ │ └── ProcessedCommandEvent.as │ │ ├── filesystem │ │ └── WireFileParser.as │ │ ├── logging │ │ └── DebugConsole.as │ │ ├── net │ │ ├── BinarySwfLoader.as │ │ ├── CommandProcessor.as │ │ ├── Cucumber.as │ │ ├── Cuke4AS3Server.as │ │ └── ICommandProcessor.as │ │ ├── process │ │ ├── CompilerProcess.as │ │ ├── CucumberArgsValidator.as │ │ ├── CucumberProcess.as │ │ ├── IArgsValidator.as │ │ ├── IProcess.as │ │ └── Process.as │ │ ├── reflection │ │ ├── IStepInvoker.as │ │ ├── IStepMatcher.as │ │ ├── StepInvoker.as │ │ ├── StepMatcher.as │ │ └── SwfProcessor.as │ │ ├── support │ │ └── flexunit │ │ │ └── MethodInvokationAsyncStatement.as │ │ ├── util │ │ ├── CucumberMessageMaker.as │ │ ├── StringUtilities.as │ │ └── deepTrace.as │ │ └── vo │ │ ├── InvokeArgumentsProcessor.as │ │ ├── InvokeInfo.as │ │ ├── MatchInfo.as │ │ └── ServerInfo.as └── test │ ├── TestRunner-app.xml │ ├── TestRunner.mxml │ ├── com │ └── flashquartermaster │ │ └── cuke4as3 │ │ ├── Cuke4AS3_Test.as │ │ ├── events │ │ ├── InvokeMethodEvent_Test.as │ │ └── ProcessedCommandEvent_Test.as │ │ ├── filesystem │ │ └── WireFileParser_Test.as │ │ ├── net │ │ ├── BinarySwfLoader_Test.as │ │ ├── CommandProcessor_Test.as │ │ ├── Cucumber_Test.as │ │ ├── Cuke4AS3Server_Test.as │ │ └── support │ │ │ └── Cuke4AS3Server_Fixture_Support.as │ │ ├── process │ │ ├── CompilerProcess_Test.as │ │ ├── CucumberArgsValidator_Test.as │ │ ├── CucumberProcess_Test.as │ │ ├── ProcessExposer.as │ │ └── Process_Test.as │ │ ├── reflection │ │ ├── StepInvoker_Test.as │ │ ├── StepMatcher_Test.as │ │ └── SwfProcessor_Test.as │ │ ├── support │ │ └── flexunit │ │ │ └── MethodInvokationAsyncStatement_Test.as │ │ ├── utils │ │ ├── CucumberMessageMaker_Test.as │ │ └── StringUtilities_Test.as │ │ └── vo │ │ ├── InvokeArgumentsProcessor_Test.as │ │ ├── InvokeInfo_Test.as │ │ ├── MatchInfo_Test.as │ │ └── ServerInfo_Test.as │ ├── features │ ├── cuke4as3 │ │ ├── asunit.feature │ │ ├── command-processor.feature │ │ ├── compiler.feature │ │ ├── core.feature │ │ ├── cucumber.feature │ │ ├── feature_files.feature │ │ ├── flex_unit.feature │ │ ├── hamcrest.feature │ │ ├── server-only.feature │ │ ├── server.feature │ │ ├── step-invoker.feature │ │ ├── step-matcher.feature │ │ ├── swf-loader.feature │ │ ├── swf-processor.feature │ │ ├── ui_test_environment.feature │ │ └── wire-file.feature │ ├── step_definitions │ │ ├── CommandProcessor_Steps.as │ │ ├── Compiler_Steps.as │ │ ├── Core_Steps.as │ │ ├── Cucumber_Steps.as │ │ ├── Cuke4AS3_Suite.as │ │ ├── Feature_Files_Steps.as │ │ ├── FlexUnit_Steps.as │ │ ├── ServerOnly_Steps.as │ │ ├── Server_Steps.as │ │ ├── StepInvoker_Steps.as │ │ ├── StepMatcher_Steps.as │ │ ├── SwfLoader_Steps.as │ │ ├── SwfProcessor_Steps.as │ │ ├── UI_Test_Environment_Steps.as │ │ ├── WireFile_Steps.as │ │ ├── Wire_Protocol_Steps.as │ │ └── cuke4AS3.wire │ └── support │ │ └── FixtureConfig.as │ └── support │ ├── Calculator_Support_Steps.as │ ├── ClassMaker.as │ ├── FileHelper.as │ ├── MockCommandProcessor.as │ ├── MockStepInvoker.as │ └── MockStepMatcher.as ├── Cuke4AS3Lib ├── README ├── cuke4as3lib-build.properties ├── cuke4as3lib-build.xml ├── libs │ ├── flexUnitTasks-4.1.0-33.jar │ ├── flexunit-4.1.0-x-as3_y.y.y.y.swc │ ├── flexunit-cilistener-4.1.0-33-3.5.0.12683.swc │ ├── flexunit-uilistener-4.1.0-33-3.5.0.12683.swc │ ├── flexunit_0.9.swc │ └── hamcrest-as3-flex-1.1.3.swc ├── src │ ├── Given.as │ ├── Then.as │ ├── When.as │ ├── com │ │ └── flashquartermaster │ │ │ └── cuke4as3 │ │ │ └── utilities │ │ │ ├── BooleanUtil.as │ │ │ ├── IStepsBase.as │ │ │ ├── Pending.as │ │ │ ├── StepsBase.as │ │ │ └── Table.as │ └── metadata.xml └── test │ ├── TestRunner.mxml │ └── com │ └── flashquartermaster │ └── cuke4as3 │ └── utilities │ ├── BooleanUtil_Test.as │ ├── StepsBase_Test.as │ └── Table_Test.as ├── DeveloperUI ├── README ├── assets │ ├── flexunit │ │ ├── flexunit-4.1.0-8-as3_4.1.0.16076.swc │ │ ├── flexunit_0.9.swc │ │ └── hamcrest-as3-flex-1.1.3.swc │ └── icons │ │ ├── icon-16.png │ │ ├── icon-32.png │ │ └── icon-48.png ├── developerui-build.properties ├── developerui-build.xml ├── libs │ ├── DConsole2SWC.swc │ ├── as3corelib.swc │ ├── flexUnitTasks-4.1.0-33.jar │ ├── flexunit-4.1.0-x-as3_y.y.y.y.swc │ ├── flexunit-cilistener-4.1.0-33-3.5.0.12683.swc │ ├── flexunit-uilistener-4.1.0-33-3.5.0.12683.swc │ ├── flexunit_0.9.swc │ └── hamcrest-as3-flex-1.1.3.swc ├── src │ ├── Cuke4AS3DeveloperUI-app.xml │ └── Cuke4AS3DeveloperUI.mxml └── test │ └── features │ └── step_definitions │ ├── Cuke4AS3_Suite.as │ └── developerui.wire ├── Examples ├── Calculator │ ├── libs │ │ └── DConsole2SWC.swc │ └── src │ │ ├── Calculator.as │ │ └── features │ │ ├── calculator.wire │ │ ├── math.feature │ │ └── step_definitions │ │ ├── Calculator_Steps.as │ │ └── Cuke4AS3_Suite.as ├── CalculatorBadCompile │ └── src │ │ ├── Calculator.as │ │ └── features │ │ ├── math.feature │ │ └── step_definitions │ │ ├── Calculator_Steps.as │ │ └── Cuke4AS3_Suite.as ├── CalculatorBadCucumber │ └── src │ │ ├── Calculator.as │ │ └── features │ │ ├── math.feature │ │ └── step_definitions │ │ ├── Calculator_Steps.as │ │ ├── Cuke4AS3_Suite.as │ │ └── bad.wire ├── CalculatorNoWire │ └── src │ │ └── features │ │ └── math.feature ├── examples-build.properties └── examples-build.xml ├── LICENSE ├── README ├── build.properties └── build.xml /Cuke4AS3/assets/flexunit/flexunit-4.1.0-8-as3_4.1.0.16076.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/assets/flexunit/flexunit-4.1.0-8-as3_4.1.0.16076.swc -------------------------------------------------------------------------------- /Cuke4AS3/assets/flexunit/flexunit_0.9.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/assets/flexunit/flexunit_0.9.swc -------------------------------------------------------------------------------- /Cuke4AS3/assets/flexunit/hamcrest-as3-flex-1.1.3.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/assets/flexunit/hamcrest-as3-flex-1.1.3.swc -------------------------------------------------------------------------------- /Cuke4AS3/assets/icons/icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/assets/icons/icon-16.png -------------------------------------------------------------------------------- /Cuke4AS3/assets/icons/icon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/assets/icons/icon-32.png -------------------------------------------------------------------------------- /Cuke4AS3/assets/icons/icon-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/assets/icons/icon-48.png -------------------------------------------------------------------------------- /Cuke4AS3/cuke4as3-build.properties: -------------------------------------------------------------------------------- 1 | FLEX_HOME=${basedir}/../../flex_sdks/flex_sdk_4.5.1 2 | #Specifiy basedir for FLEX_HOME because flexunit task gets confused 3 | #when writing out the descriptor xml for air when running this task 4 | #from the main build.xml in the parent directory 5 | ADL=${FLEX_HOME}/bin/adl 6 | ADT=${FLEX_HOME}/bin/adt 7 | ADT.JAR=${FLEX_HOME}/lib/adt.jar 8 | 9 | project.name=Cuke4AS3 10 | project.title=Cuke4AS3 11 | 12 | src.dir=${basedir}/src 13 | tests.dir=${basedir}/test 14 | libs.dir=${basedir}/libs 15 | 16 | package.dir=com/flashquartermaster/cuke4as3 17 | reverse.dns=com.flashquartermaster.cuke4as3 18 | 19 | output.dir=${basedir}/build 20 | docs.dir=${output.dir}/docs 21 | 22 | tests.runner=TestRunner 23 | tests.swf=${output.dir}/${tests.runner}.swf 24 | report.dir=${output.dir}/report 25 | 26 | bin.dir=${output.dir}/bin 27 | 28 | bundledlibs.dir=${output.dir}/bundled_libs 29 | bundledlibs.dconsole.dir=${bundledlibs.dir}/dconsole 30 | bundledlibs.flexunit.dir=${bundledlibs.dir}/flexunit 31 | 32 | app.descriptor=${output.dir}/${project.name}-app.xml 33 | 34 | assets.dir=${basedir}/assets 35 | 36 | dist.dir=${basedir}/dist -------------------------------------------------------------------------------- /Cuke4AS3/libs/DConsole2SWC.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/libs/DConsole2SWC.swc -------------------------------------------------------------------------------- /Cuke4AS3/libs/as3commons-bytecode-1.0.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/libs/as3commons-bytecode-1.0.swc -------------------------------------------------------------------------------- /Cuke4AS3/libs/as3commons-lang-0.3.4.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/libs/as3commons-lang-0.3.4.swc -------------------------------------------------------------------------------- /Cuke4AS3/libs/as3commons-logging-2.6.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/libs/as3commons-logging-2.6.swc -------------------------------------------------------------------------------- /Cuke4AS3/libs/as3commons-reflect-1.5.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/libs/as3commons-reflect-1.5.swc -------------------------------------------------------------------------------- /Cuke4AS3/libs/as3corelib.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/libs/as3corelib.swc -------------------------------------------------------------------------------- /Cuke4AS3/libs/flexUnitTasks-4.1.0-33.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/libs/flexUnitTasks-4.1.0-33.jar -------------------------------------------------------------------------------- /Cuke4AS3/libs/flexunit-4.1.0-x-as3_y.y.y.y.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/libs/flexunit-4.1.0-x-as3_y.y.y.y.swc -------------------------------------------------------------------------------- /Cuke4AS3/libs/flexunit-cilistener-4.1.0-33-3.5.0.12683.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/libs/flexunit-cilistener-4.1.0-33-3.5.0.12683.swc -------------------------------------------------------------------------------- /Cuke4AS3/libs/flexunit-uilistener-4.1.0-33-3.5.0.12683.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/libs/flexunit-uilistener-4.1.0-33-3.5.0.12683.swc -------------------------------------------------------------------------------- /Cuke4AS3/libs/flexunit_0.9.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/libs/flexunit_0.9.swc -------------------------------------------------------------------------------- /Cuke4AS3/libs/hamcrest-as3-flex-1.1.3.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3/libs/hamcrest-as3-flex-1.1.3.swc -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/Config.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3 29 | { 30 | import flash.filesystem.File; 31 | 32 | public class Config 33 | { 34 | public static const OUTPUT_SWF:String = "cuke4as3_steps.swf"; 35 | public static const FEATURES_DIR:String = "features" + File.separator 36 | public static const STEP_DEFINITIONS_DIR:String = FEATURES_DIR + "step_definitions" + File.separator; 37 | public static const SUITE_NAME:String = "Cuke4AS3_Suite.as"; 38 | 39 | //Error codes 40 | //Cuke 41 | public static const CUKE_CANNOT_RUN_ERROR:int = 1000; 42 | public static const CUKE_NO_WIRE_FILE:int = 1001; 43 | 44 | //Server 45 | public static const SERVER_CANNOT_RUN_ERROR:int = 2000; 46 | public static const SERVER_RUN_ERROR:int = 2001; 47 | //Process 48 | public static const VALIDATION_ERROR:int = 3000; 49 | public static const ARGUMENTS_VALIDATION_ERROR:int = 3001; 50 | public static const SHELL_EXIT_WITH_ERRORS:int = 3010; 51 | public static const SHELL_EXIT_UNKNOWN_EXIT_CODE:int = 3011; 52 | public static const FORCED_SHELL_EXIT:int = 3012; 53 | 54 | public static const COMPILER_ERRORS:int = 3020; 55 | } 56 | } -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/events/InvokeMethodEvent.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.events 29 | { 30 | import com.flashquartermaster.cuke4as3.vo.InvokeInfo; 31 | 32 | import flash.events.Event; 33 | 34 | public class InvokeMethodEvent extends Event 35 | { 36 | public static var RESULT:String = "invokeMethodEventResult"; 37 | private var _result:InvokeInfo; 38 | 39 | public function InvokeMethodEvent(type:String, result:InvokeInfo, bubbles:Boolean=false, cancelable:Boolean=false) 40 | { 41 | super(type, bubbles, cancelable); 42 | _result = result; 43 | } 44 | 45 | public function get result():InvokeInfo 46 | { 47 | return _result; 48 | } 49 | 50 | override public function clone():Event 51 | { 52 | return new InvokeMethodEvent( type, _result, bubbles, cancelable ); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/events/ProcessedCommandEvent.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.events 29 | { 30 | import flash.events.Event; 31 | 32 | public class ProcessedCommandEvent extends Event 33 | { 34 | public static var SUCCESS:String = "commandSuccessEvent"; 35 | public static var ERROR:String = "commandErrorEvent"; 36 | private var _payload:Array; 37 | 38 | public function ProcessedCommandEvent(type:String, result:Array = null, bubbles:Boolean=false, cancelable:Boolean=false) 39 | { 40 | super(type, bubbles, cancelable); 41 | _payload = result; 42 | } 43 | 44 | public function get result():Array 45 | { 46 | return _payload; 47 | } 48 | 49 | public function set result( value:Array ):void 50 | { 51 | _payload = value; 52 | } 53 | 54 | override public function clone():Event 55 | { 56 | return new ProcessedCommandEvent( type, _payload, bubbles, cancelable ); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/filesystem/WireFileParser.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.filesystem 29 | { 30 | import com.flashquartermaster.cuke4as3.Config; 31 | import com.flashquartermaster.cuke4as3.vo.ServerInfo; 32 | import com.furusystems.logging.slf4as.global.debug; 33 | import com.furusystems.logging.slf4as.global.info; 34 | 35 | import flash.filesystem.File; 36 | import flash.filesystem.FileMode; 37 | import flash.filesystem.FileStream; 38 | 39 | public class WireFileParser 40 | { 41 | private var _wireFile:File; 42 | 43 | public function WireFileParser() 44 | { 45 | } 46 | 47 | public function getServerInfoFromWireFile( srcDir:String ):ServerInfo 48 | { 49 | info("WireFileParser : getServerInfoFromWireFile"); 50 | var serverInfo:ServerInfo; 51 | 52 | var featuresDir:File = new File( srcDir + File.separator + Config.FEATURES_DIR ); 53 | var stepsDir:File = new File( srcDir + File.separator + Config.STEP_DEFINITIONS_DIR ); 54 | 55 | //Cucumber reads the steps directory first then the features directory 56 | //so we shall do the same 57 | _wireFile = getWireFileFromDirectory( stepsDir.getDirectoryListing() ); 58 | 59 | if( _wireFile == null ) 60 | _wireFile = getWireFileFromDirectory( featuresDir.getDirectoryListing() ); 61 | 62 | if( _wireFile != null ) 63 | { 64 | //Found wire file so get the server info 65 | serverInfo = processWireFile(); 66 | } 67 | else 68 | { 69 | throw new Error("No wire file found in \"" + featuresDir.nativePath + "\" or \"" + stepsDir.nativePath + "\""); 70 | } 71 | 72 | return serverInfo; 73 | } 74 | 75 | private function getWireFileFromDirectory( directory:Array ):File 76 | { 77 | var i:uint = directory.length; 78 | var name:String; 79 | var wireFile:File; 80 | 81 | while( --i > -1 ) 82 | { 83 | var file:File = directory[i] as File; 84 | name = file.name; 85 | if( name.indexOf( ".wire" ) != -1) 86 | { 87 | wireFile = file; 88 | break; 89 | } 90 | } 91 | 92 | return wireFile; 93 | } 94 | 95 | private function processWireFile():ServerInfo 96 | { 97 | var serverInfo:ServerInfo = new ServerInfo(); 98 | 99 | var fileStream:FileStream = new FileStream(); 100 | fileStream.open(_wireFile, FileMode.READ); 101 | 102 | var fileString:String = fileStream.readUTFBytes( fileStream.bytesAvailable ); 103 | var getHost:RegExp = /host:\s*?(\S.*)/gi //host:\s*?(\d{0,3}\.){3}\d{0,3}|host:\s*?(localhost) 104 | var getPort:RegExp = /port:\s*?(\d+)$/gi; 105 | 106 | //Note: At some point we are going to have to support getting environment variables 107 | //Since cucumber can run on ERB so the port declaration will look like 108 | //port: <%= ENV['PORT'] || 12345 %> 109 | 110 | var host:Object = getHost.exec( fileString ); 111 | var port:Object = getPort.exec( fileString ); 112 | 113 | serverInfo.host = ( host[1] as String ).indexOf( "localhost") != -1 ? "127.0.0.1" : host[1]; 114 | serverInfo.port = int( port[1] ); 115 | 116 | return serverInfo; 117 | } 118 | 119 | public function destroy():void 120 | { 121 | info("WireFileParser : destroy"); 122 | _wireFile = null; 123 | } 124 | } 125 | } -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/logging/DebugConsole.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | *Based on Hello world and intro to DConsole64 by Andreas Rønning 26 | * @author Tom Coxen 27 | * @version 28 | **/ 29 | package com.flashquartermaster.cuke4as3.logging 30 | { 31 | import com.furusystems.dconsole2.DConsole; 32 | import com.furusystems.dconsole2.core.gui.maindisplay.ConsoleView; 33 | import com.furusystems.dconsole2.plugins.plugcollections.AllPlugins; 34 | import com.furusystems.logging.slf4as.ILogger; 35 | import com.furusystems.logging.slf4as.Logging; 36 | import com.furusystems.logging.slf4as.global.debug; 37 | import com.furusystems.logging.slf4as.global.error; 38 | import com.furusystems.logging.slf4as.global.fatal; 39 | import com.furusystems.logging.slf4as.global.info; 40 | import com.furusystems.logging.slf4as.global.warn; 41 | 42 | import flash.display.DisplayObject; 43 | import flash.display.Sprite; 44 | import flash.display.StageAlign; 45 | import flash.display.StageScaleMode; 46 | import flash.events.Event; 47 | 48 | import mx.core.UIComponent; 49 | 50 | public class DebugConsole extends UIComponent 51 | { 52 | public function DebugConsole():void 53 | { 54 | if (stage) init(); 55 | else addEventListener(Event.ADDED_TO_STAGE, init); 56 | } 57 | 58 | private function init(e:Event = null):void 59 | { 60 | removeEventListener(Event.ADDED_TO_STAGE, init); 61 | 62 | // DConsole.clearPersistentData(); 63 | addChild(DConsole.view); 64 | // DConsole.registerPlugins(BasicPlugins); 65 | DConsole.registerPlugins(AllPlugins); 66 | // DConsole.show(); 67 | 68 | 69 | DConsole.createCommand("myCommand", myMethod, "My commands", "My helpful string"); 70 | 71 | 72 | DConsole.setTitle("Cuke4AS3 Console"); 73 | } 74 | 75 | private function myMethod(input:String):Array 76 | { 77 | return input.split(""); 78 | } 79 | } 80 | 81 | } -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/net/Cucumber.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.net 29 | { 30 | import com.adobe.serialization.json.JSON; 31 | import com.furusystems.logging.slf4as.global.error; 32 | import com.furusystems.logging.slf4as.global.info; 33 | 34 | import flash.events.Event; 35 | import flash.events.ProgressEvent; 36 | import flash.net.Socket; 37 | 38 | public class Cucumber 39 | { 40 | protected var _socket:Socket; 41 | private var _rawSocketData:String; 42 | public static var EOT:String = "\n"; 43 | 44 | public function Cucumber( socket:Socket ) 45 | { 46 | _socket = socket; 47 | _socket.addEventListener( Event.CONNECT, connectHandler ); 48 | _socket.addEventListener( ProgressEvent.SOCKET_DATA, socketDataHandler ); 49 | } 50 | 51 | public function destroy():void 52 | { 53 | info( "Cucumber : destroy" ); 54 | if( _socket != null ) 55 | { 56 | _socket.removeEventListener( Event.CONNECT, connectHandler ); 57 | _socket.removeEventListener( ProgressEvent.SOCKET_DATA, socketDataHandler ); 58 | if( _socket.connected ) 59 | { 60 | _socket.close(); 61 | } 62 | _socket = null; 63 | } 64 | _rawSocketData = null; 65 | } 66 | 67 | public function jsonEncodeAndSend( a:Array ):void 68 | { 69 | var encoded:String = JSON.encode( a ); 70 | socket.writeUTFBytes( encoded + EOT ); 71 | socket.flush(); 72 | } 73 | 74 | public function jsonDecodeSocketData():Array 75 | { 76 | var ret:Array = new Array(); 77 | try 78 | { 79 | ret = JSON.decode( rawSocketData ); 80 | } 81 | catch( e:Error ) 82 | { 83 | error( "Cucumber : jsonDecodedSocketData : Error :", e ); 84 | } 85 | return ret; 86 | } 87 | 88 | private function connectHandler( event:Event ):void 89 | { 90 | info( "Cucumber : connectHandler :", event ); 91 | _rawSocketData = socket.readUTFBytes( socket.bytesAvailable ); 92 | } 93 | 94 | private function socketDataHandler( event:ProgressEvent ):void 95 | { 96 | _rawSocketData = socket.readUTFBytes( socket.bytesAvailable ); 97 | } 98 | 99 | public function get rawSocketData():String 100 | { 101 | return _rawSocketData; 102 | } 103 | 104 | public function set rawSocketData( value:String ):void 105 | { 106 | _rawSocketData = value; 107 | } 108 | 109 | public function get socket():Socket 110 | { 111 | return _socket; 112 | } 113 | } 114 | } -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/net/ICommandProcessor.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.net 29 | { 30 | import com.flashquartermaster.cuke4as3.reflection.IStepInvoker; 31 | import com.flashquartermaster.cuke4as3.reflection.IStepMatcher; 32 | 33 | import flash.events.IEventDispatcher; 34 | 35 | public interface ICommandProcessor extends IEventDispatcher 36 | { 37 | function processCommand( action:String, data:Object ):void; 38 | 39 | function destroy():void; 40 | 41 | function set stepMatcher( value:IStepMatcher ):void; 42 | 43 | function set stepInvoker( value:IStepInvoker ):void; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/process/CucumberArgsValidator.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.process 29 | { 30 | import com.furusystems.logging.slf4as.global.debug; 31 | 32 | import flash.filesystem.File; 33 | 34 | public class CucumberArgsValidator implements IArgsValidator 35 | { 36 | private var _args:Vector.; 37 | 38 | private var _htmlFilePath:String; 39 | 40 | public function CucumberArgsValidator() 41 | { 42 | } 43 | 44 | public function validate( args:Vector. ):Boolean 45 | { 46 | _args = args; 47 | return true; 48 | } 49 | 50 | public function get htmlFilePath():String 51 | { 52 | setHtmlOutput(); 53 | return _htmlFilePath; 54 | } 55 | 56 | public function destroy():void 57 | { 58 | _args = null; 59 | _htmlFilePath = null; 60 | } 61 | 62 | private function setHtmlOutput():void 63 | { 64 | var i:uint; 65 | var len:uint = _args.length; 66 | var arg:String; 67 | 68 | var isFormat:Boolean = false; 69 | var isHtml:Boolean = false; 70 | var isOutput:Boolean = false; 71 | 72 | while(i < len ) 73 | { 74 | arg = _args[i].toLowerCase(); 75 | 76 | if( isOutput ) 77 | { 78 | _htmlFilePath = _args[i];//Or file path is to lower case 79 | break; 80 | } 81 | else if(isFormat && !isHtml ) 82 | { 83 | isHtml = ( arg == "html"); 84 | } 85 | else if( isFormat && isHtml ) 86 | { 87 | isOutput = ( arg == "-o" || arg == "-out"); 88 | } 89 | else 90 | { 91 | isFormat = ( arg == "-f" || arg == "-format"); 92 | } 93 | 94 | i++; 95 | } 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/process/CucumberProcess.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.process 29 | { 30 | import com.flashquartermaster.cuke4as3.Config; 31 | import com.flashquartermaster.cuke4as3.util.deepTrace; 32 | import com.furusystems.logging.slf4as.global.info; 33 | 34 | import flash.events.ErrorEvent; 35 | import flash.filesystem.File; 36 | 37 | public class CucumberProcess extends Process 38 | { 39 | private var _cucumberPath:String; 40 | 41 | private var _argValidator:CucumberArgsValidator; 42 | 43 | public function CucumberProcess() 44 | { 45 | super(); 46 | } 47 | 48 | override protected function validate():void 49 | { 50 | super.validate(); 51 | 52 | var cucumber:File = validateFilePath( _cucumberPath, "cucumber" ); 53 | 54 | _executable = cucumber; 55 | } 56 | 57 | override protected function constructCompilerArgs():void 58 | { 59 | super.constructCompilerArgs(); 60 | 61 | _processArgs.push( _srcDir ); 62 | 63 | deepTrace( "CucumberProcess : args :", _processArgs, 1 ); 64 | 65 | _argValidator = new CucumberArgsValidator(); 66 | 67 | if( !_argValidator.validate( _processArgs ) ) 68 | { 69 | dispatchEvent( new ErrorEvent( PROCESS_ERROR_EVENT, false, false, "Invalid Arguments: " + additionalArgs, Config.ARGUMENTS_VALIDATION_ERROR ) ); 70 | } 71 | } 72 | 73 | override public function destroy():void 74 | { 75 | info( "CucumberProcess : destroy" ); 76 | super.destroy(); 77 | 78 | _cucumberPath = null; 79 | 80 | if( _argValidator != null ) 81 | { 82 | _argValidator.destroy(); 83 | _argValidator = null; 84 | } 85 | } 86 | 87 | //Accessors 88 | 89 | public function get cucumberPath():String 90 | { 91 | return _cucumberPath; 92 | } 93 | 94 | public function set cucumberPath( value:String ):void 95 | { 96 | _cucumberPath = value; 97 | } 98 | 99 | public function get argValidator():CucumberArgsValidator 100 | { 101 | return _argValidator; 102 | } 103 | } 104 | } -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/process/IArgsValidator.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.process 29 | { 30 | public interface IArgsValidator 31 | { 32 | function validate( args:Vector. ):Boolean; 33 | 34 | function destroy():void; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/process/IProcess.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.process 29 | { 30 | public interface IProcess 31 | { 32 | function run():void; 33 | } 34 | } -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/reflection/IStepInvoker.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.reflection 29 | { 30 | import flash.events.IEventDispatcher; 31 | import flash.system.ApplicationDomain; 32 | 33 | public interface IStepInvoker extends IEventDispatcher 34 | { 35 | function invoke( data:Object ):void; 36 | 37 | function getInvokationId( methodXml:XML ):uint; 38 | 39 | function destroy():void; 40 | 41 | function set applicationDomain( applicationDomain:ApplicationDomain ):void; 42 | 43 | function get stepsObject():*; 44 | 45 | function resetState():void; 46 | 47 | function isExecutingClass( declaredBy:String ):Boolean; 48 | 49 | function isExecutingScenario():Boolean 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/reflection/IStepMatcher.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.reflection 29 | { 30 | import com.flashquartermaster.cuke4as3.vo.MatchInfo; 31 | 32 | public interface IStepMatcher 33 | { 34 | function match( matchString:String ):MatchInfo; 35 | 36 | function destroy():void; 37 | 38 | function get matchableSteps():XMLList; 39 | 40 | function set matchableSteps( value:XMLList ):void; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/support/flexunit/MethodInvokationAsyncStatement.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.support.flexunit 29 | { 30 | import org.flexunit.internals.runners.statements.AsyncStatementBase; 31 | import org.flexunit.internals.runners.statements.IAsyncStatement; 32 | import org.flexunit.token.AsyncTestToken; 33 | import org.flexunit.token.ChildResult; 34 | import org.flexunit.utils.ClassNameUtil; 35 | 36 | public class MethodInvokationAsyncStatement extends AsyncStatementBase implements IAsyncStatement 37 | { 38 | private var _method:Function; 39 | private var _args:Array; 40 | private var _stepsObject:*; 41 | 42 | public function evaluate( parentToken:AsyncTestToken ):void 43 | { 44 | var returnVal:Object; 45 | try { 46 | if ( _args.length > 0 ) { 47 | returnVal = _method.apply( _stepsObject, _args ); 48 | } else { 49 | returnVal = _method.apply( _stepsObject ); 50 | } 51 | parentToken.sendResult(); 52 | } catch ( error:Error ) { 53 | parentToken.sendResult( error ); 54 | } 55 | } 56 | 57 | public function set method(value:Function):void 58 | { 59 | _method = value; 60 | } 61 | 62 | public function set args(value:Array):void 63 | { 64 | _args = value; 65 | } 66 | 67 | public function set stepsObject(value:*):void 68 | { 69 | _stepsObject = value; 70 | } 71 | 72 | public function get method():Function 73 | { 74 | return _method; 75 | } 76 | 77 | public function get args():Array 78 | { 79 | return _args; 80 | } 81 | 82 | public function get stepsObject():* 83 | { 84 | return _stepsObject; 85 | } 86 | 87 | 88 | //based On 89 | // var meth:Method = new Method( methodToRun, false ); 90 | // var fmethod:FrameworkMethod = new FrameworkMethod( meth ); 91 | // var statement:IAsyncStatement = new InvokeMethod(fmethod, _stepsObject); 92 | 93 | // public function MethodInvokationAsyncStatement():void 94 | // { 95 | // myToken = new AsyncTestToken( ClassNameUtil.getLoggerFriendlyClassName( this ) ); 96 | // myToken.addNotificationMethod( handleMethodExecuteComplete ); 97 | // } 98 | 99 | // protected function handleMethodExecuteComplete( result:ChildResult ):void { 100 | // trace("MethodInvokationAsyncStatement : handleMethodExecuteComplete :", result.error); 101 | // parentToken.sendResult( null ); 102 | // } 103 | } 104 | } -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/util/StringUtilities.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.util 29 | { 30 | public class StringUtilities 31 | { 32 | 33 | public static function stripSingleQuotesAtStartAndEndOfString( s:String ):String 34 | { 35 | var stripped:Object = /^'(.*)'$/.exec( s ); 36 | return stripped[1]; 37 | } 38 | 39 | public static function testStripSingleQuotesAtStartAndEndOfString( s:String ):Boolean 40 | { 41 | return /^'(.*)'$/.test( s ); 42 | } 43 | 44 | public static function isNotNullAndNotEmptyString( s:String ):Boolean 45 | { 46 | return (s != null && s != ""); 47 | } 48 | 49 | //For grabbing args and paths enclosed in quotes 50 | public static function stripWhiteSpaceExceptWhereEnclosedBySingleQuotes( s:String ):Array 51 | { 52 | return s.match( /'(.*?)'|(\S+)/g ); 53 | } 54 | 55 | public static function isActionScriptFileExtension( filename:String ):Boolean 56 | { 57 | var len:int = filename.length; 58 | return ( filename.substring( len - 3, len ).indexOf( ".as" ) == 0 ); 59 | } 60 | 61 | public static function getClassNameFromDeclaredBy( className:String ):String 62 | { 63 | // e.g. "features.step_definitions::Calculator_Steps"> 64 | var colonReplace:RegExp = /::/g; 65 | className = className.replace( colonReplace, "." ); 66 | return className; 67 | } 68 | 69 | public static function replaceFilePathWithClassPath( filePath:String, className:String ):String 70 | { 71 | //Note: Cross platform 72 | return filePath.replace( /(\/|\\)/g, "." ) + removeFileExtension( className ); 73 | } 74 | 75 | public static function removeFileExtension( fileName:String ):String 76 | { 77 | return fileName.replace( /(\..+)$/, "" ); 78 | } 79 | 80 | public static function formatStepToFunctionName( s:String ):String 81 | { 82 | s = s.toLowerCase(); 83 | s = s.replace(/\W+/g,"_"); 84 | s = s.replace( /^_|_$/g, "" ); 85 | s = s.replace( /\d+/g, "n" ); 86 | return s; 87 | } 88 | 89 | public static function createCapturingGroups( s:String ):String 90 | { 91 | s = s.replace( /"[^"]*"/g, "\"([^\"]*)\"" ); 92 | s = s.replace( /\d+/g, "(\\d+)" ); 93 | return s; 94 | } 95 | 96 | public static function getCapturingGroupDataTypes( regExp:String ):Array 97 | { 98 | var return_array:Array = []; 99 | 100 | var pattern:RegExp = /("\(\[\^"\]\*\)"|\(\\d\+\))/g; 101 | 102 | var result:Object = pattern.exec( regExp ); 103 | 104 | while( result != null ) 105 | { 106 | if( result[0] == "\"([^\"]*)\"" ) 107 | { 108 | return_array.push( "String" ); 109 | } 110 | else if( result[0] == "(\\d+)" ) 111 | { 112 | return_array.push( "Number" ); 113 | } 114 | 115 | result = pattern.exec( regExp ); 116 | } 117 | 118 | return return_array; 119 | } 120 | 121 | } 122 | } -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/util/deepTrace.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.util 29 | { 30 | import com.furusystems.logging.slf4as.global.debug; 31 | 32 | public function deepTrace( msg:String, obj : *, level : int = 0 ) : void 33 | { 34 | var tabs : String = ""; 35 | for ( var i : int = 0 ; i < level ; i++, tabs += "\t" ) 36 | { 37 | if(i == 0) 38 | debug( msg,"deepTrace",obj,"to level",level ); 39 | for ( var prop : String in obj ){ 40 | debug( tabs + "[" + prop + "] -> " + obj[ prop ] ); 41 | deepTrace( obj[ prop ], level + 1 ); 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/vo/InvokeArgumentsProcessor.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.vo 29 | { 30 | import com.furusystems.logging.slf4as.global.error; 31 | 32 | public class InvokeArgumentsProcessor 33 | { 34 | private var _args:Array; 35 | private var _srcDir:String; 36 | private var _mxmlc:String; 37 | private var _cucumber:String; 38 | private var _headless:String; 39 | private var _mxmlcArgs:String; 40 | private var _cucumberArgs:String; 41 | 42 | public function InvokeArgumentsProcessor() 43 | { 44 | } 45 | 46 | public function processArguments( args:Array ):Boolean 47 | { 48 | if( args == null || args.length == 0) 49 | return false; 50 | else 51 | { 52 | _args = args; 53 | return process(); 54 | } 55 | } 56 | 57 | private function process():Boolean 58 | { 59 | //Valid args -srcDir -mxmlc -cucumber -headless -mxmlcArgs -cucumberArgs 60 | var lastArg:int = _args.length; 61 | var lastKey:String; 62 | 63 | try 64 | { 65 | for( var i:uint = 0; i < lastArg ; i++) 66 | { 67 | var keyValue:String = _args[i]; 68 | if( keyValue.indexOf( "-" ) == 0 )//hyphen at the start of the string 69 | { 70 | var noHyphen:String = keyValue.substring(1); 71 | this[ noHyphen ]; 72 | lastKey = noHyphen; 73 | } 74 | else 75 | { 76 | this[ lastKey ] = keyValue; 77 | // argsObj[ lastKey ] = ( argsObj[ lastKey ] != null ? argsObj[ lastKey ] + "," + keyValue : keyValue );//For multiple args e.g. multiple srcDirs 78 | } 79 | } 80 | return true; 81 | } 82 | catch( e:ReferenceError ) 83 | { 84 | //Found arg with no accessor or hyphen is missing 85 | error("InvokeArgumentsProcessor : process :",e); 86 | } 87 | return false; 88 | } 89 | 90 | public function get srcDir():String 91 | { 92 | return _srcDir; 93 | } 94 | 95 | public function set srcDir(value:String):void 96 | { 97 | _srcDir = value; 98 | } 99 | 100 | public function get mxmlc():String 101 | { 102 | return _mxmlc; 103 | } 104 | 105 | public function set mxmlc(value:String):void 106 | { 107 | _mxmlc = value; 108 | } 109 | 110 | public function get cucumber():String 111 | { 112 | return _cucumber; 113 | } 114 | 115 | public function set cucumber(value:String):void 116 | { 117 | _cucumber = value; 118 | } 119 | 120 | public function get headless():String 121 | { 122 | return _headless; 123 | } 124 | 125 | public function set headless(value:String):void 126 | { 127 | _headless = value; 128 | } 129 | 130 | public function get mxmlcArgs():String 131 | { 132 | return _mxmlcArgs; 133 | } 134 | 135 | public function set mxmlcArgs(value:String):void 136 | { 137 | _mxmlcArgs = value; 138 | } 139 | 140 | public function get cucumberArgs():String 141 | { 142 | return _cucumberArgs; 143 | } 144 | 145 | public function set cucumberArgs(value:String):void 146 | { 147 | _cucumberArgs = value; 148 | } 149 | 150 | public function destroy():void 151 | { 152 | _args = null; 153 | _srcDir= null; 154 | _mxmlc= null; 155 | _cucumber= null; 156 | _headless= null; 157 | _mxmlcArgs= null; 158 | _cucumberArgs= null; 159 | } 160 | } 161 | } -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/vo/InvokeInfo.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.vo 29 | { 30 | public class InvokeInfo 31 | { 32 | private var _errorMessage:String; 33 | private var _errorName:String; 34 | private var _errorTrace:String; 35 | 36 | private var _pendingMessage:String; 37 | 38 | public function InvokeInfo() 39 | { 40 | } 41 | 42 | public function isError():Boolean 43 | { 44 | return _errorMessage != null; 45 | } 46 | 47 | public function isPending():Boolean 48 | { 49 | return _pendingMessage != null; 50 | } 51 | 52 | public function isSuccess():Boolean 53 | { 54 | return ( !isError() && !isPending() ); 55 | } 56 | 57 | public function destroy():void 58 | { 59 | _errorMessage = null; 60 | _errorName = null; 61 | _errorTrace = null; 62 | _pendingMessage = null; 63 | } 64 | 65 | public function get errorMessage():String 66 | { 67 | return _errorMessage; 68 | } 69 | 70 | public function set errorMessage( value:String ):void 71 | { 72 | _errorMessage = value; 73 | } 74 | 75 | public function get errorName():String 76 | { 77 | return _errorName; 78 | } 79 | 80 | public function set errorName( value:String ):void 81 | { 82 | _errorName = value; 83 | } 84 | 85 | public function get errorTrace():String 86 | { 87 | return _errorTrace; 88 | } 89 | 90 | public function set errorTrace( value:String ):void 91 | { 92 | _errorTrace = value; 93 | } 94 | 95 | public function get pendingMessage():String 96 | { 97 | return _pendingMessage; 98 | } 99 | 100 | public function set pendingMessage( value:String ):void 101 | { 102 | _pendingMessage = value; 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/vo/MatchInfo.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.vo 29 | { 30 | public class MatchInfo 31 | { 32 | private var _errorMessage:String; 33 | 34 | private var _id:int = -1; 35 | private var _args:Array; 36 | private var _className:String; 37 | private var _regExp:String; 38 | 39 | public function MatchInfo() 40 | { 41 | } 42 | 43 | public function isError():Boolean 44 | { 45 | return _errorMessage != null; 46 | } 47 | 48 | public function isMatch():Boolean 49 | { 50 | return _id > -1; 51 | } 52 | 53 | public function isUndefined():Boolean 54 | { 55 | return ( !isError() && !isMatch() ); 56 | } 57 | 58 | public function destroy():void 59 | { 60 | _errorMessage = null; 61 | _id = -1; 62 | _args = null; 63 | _className = null; 64 | _regExp = null; 65 | } 66 | 67 | public function get errorMessage():String 68 | { 69 | return _errorMessage; 70 | } 71 | 72 | public function set errorMessage( value:String ):void 73 | { 74 | _errorMessage = value; 75 | } 76 | 77 | public function get id():int 78 | { 79 | return _id; 80 | } 81 | 82 | public function set id( value:int ):void 83 | { 84 | _id = value; 85 | } 86 | 87 | public function get args():Array 88 | { 89 | return _args; 90 | } 91 | 92 | public function set args( value:Array ):void 93 | { 94 | _args = value; 95 | } 96 | 97 | public function get className():String 98 | { 99 | return _className; 100 | } 101 | 102 | public function set className( value:String ):void 103 | { 104 | _className = value; 105 | } 106 | 107 | public function get regExp():String 108 | { 109 | return _regExp; 110 | } 111 | 112 | public function set regExp( value:String ):void 113 | { 114 | _regExp = value; 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /Cuke4AS3/src/com/flashquartermaster/cuke4as3/vo/ServerInfo.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.vo 29 | { 30 | public class ServerInfo 31 | { 32 | private var _host:String = "0.0.0.0"; 33 | private var _port:int = 54321; 34 | 35 | public function ServerInfo() 36 | { 37 | } 38 | 39 | public function get port():int 40 | { 41 | return _port; 42 | } 43 | 44 | public function set port(value:int):void 45 | { 46 | _port = value; 47 | } 48 | 49 | public function get host():String 50 | { 51 | return _host; 52 | } 53 | 54 | public function set host(value:String):void 55 | { 56 | _host = value; 57 | } 58 | 59 | public function destroy():void 60 | { 61 | _host = null; 62 | _port = 0; 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /Cuke4AS3/test/TestRunner-app.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | TestRunner 5 | 6 | TestRunner 7 | 8 | TestRunner 9 | 10 | 0.0.0 11 | 12 | 13 | [content] 14 | 15 | false 16 | false 17 | false 18 | 19 | 20 | desktop extendedDesktop 21 | 22 | 23 | -------------------------------------------------------------------------------- /Cuke4AS3/test/TestRunner.mxml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /Cuke4AS3/test/com/flashquartermaster/cuke4as3/events/InvokeMethodEvent_Test.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.events 29 | { 30 | import com.flashquartermaster.cuke4as3.vo.InvokeInfo; 31 | 32 | import flash.events.Event; 33 | import flash.events.EventPhase; 34 | 35 | import org.flexunit.assertThat; 36 | import org.hamcrest.core.allOf; 37 | import org.hamcrest.object.equalTo; 38 | import org.hamcrest.object.instanceOf; 39 | import org.hamcrest.object.isFalse; 40 | import org.hamcrest.object.notNullValue; 41 | 42 | public class InvokeMethodEvent_Test 43 | { 44 | private var _sut:InvokeMethodEvent; 45 | 46 | [Before] 47 | public function setUp():void 48 | { 49 | _sut = new InvokeMethodEvent( InvokeMethodEvent.RESULT, new InvokeInfo() ); 50 | } 51 | 52 | [After] 53 | public function tearDown():void 54 | { 55 | _sut = null; 56 | } 57 | 58 | [BeforeClass] 59 | public static function setUpBeforeClass():void 60 | { 61 | } 62 | 63 | [AfterClass] 64 | public static function tearDownAfterClass():void 65 | { 66 | } 67 | 68 | [Test] 69 | public function should_construct():void 70 | { 71 | assertThat( _sut, notNullValue() ); 72 | assertThat( _sut, instanceOf( InvokeMethodEvent ) ); 73 | assertThat( _sut, instanceOf( Event ) ); 74 | assertThat( _sut.type, equalTo( InvokeMethodEvent.RESULT ) ); 75 | assertThat( _sut.result, instanceOf( InvokeInfo ) ); 76 | assertThat( _sut.bubbles, isFalse() ); 77 | assertThat( _sut.cancelable, isFalse() ); 78 | assertThat( _sut.eventPhase, EventPhase.AT_TARGET ); 79 | } 80 | 81 | [Test] 82 | public function should_clone():void 83 | { 84 | var clone:InvokeMethodEvent = ( _sut.clone() as InvokeMethodEvent ); 85 | 86 | assertThat( clone.type, equalTo( _sut.type ) ); 87 | assertThat( clone.result, equalTo( _sut.result ) ); 88 | assertThat( clone.bubbles, equalTo( _sut.bubbles ) ); 89 | assertThat( clone.cancelable, equalTo( _sut.cancelable ) ); 90 | assertThat( clone.eventPhase, allOf( equalTo( _sut.eventPhase ), equalTo( EventPhase.AT_TARGET ) ) ); 91 | } 92 | 93 | [Test] 94 | public function should_get_result():void 95 | { 96 | var result:InvokeInfo = _sut.result; 97 | 98 | assertThat( result, instanceOf( InvokeInfo ) ); 99 | } 100 | } 101 | } -------------------------------------------------------------------------------- /Cuke4AS3/test/com/flashquartermaster/cuke4as3/events/ProcessedCommandEvent_Test.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.events 29 | { 30 | import flash.events.Event; 31 | import flash.events.EventPhase; 32 | 33 | import org.hamcrest.assertThat; 34 | import org.hamcrest.collection.arrayWithSize; 35 | import org.hamcrest.core.allOf; 36 | import org.hamcrest.object.equalTo; 37 | import org.hamcrest.object.instanceOf; 38 | import org.hamcrest.object.isFalse; 39 | import org.hamcrest.object.notNullValue; 40 | 41 | public class ProcessedCommandEvent_Test 42 | { 43 | private var _sut:ProcessedCommandEvent; 44 | 45 | [Before] 46 | public function setUp():void 47 | { 48 | _sut = new ProcessedCommandEvent( ProcessedCommandEvent.SUCCESS, [] ); 49 | } 50 | 51 | [After] 52 | public function tearDown():void 53 | { 54 | _sut = null; 55 | } 56 | 57 | [BeforeClass] 58 | public static function setUpBeforeClass():void 59 | { 60 | } 61 | 62 | [AfterClass] 63 | public static function tearDownAfterClass():void 64 | { 65 | } 66 | 67 | [Test] 68 | public function should_construct():void 69 | { 70 | assertThat( _sut, notNullValue() ); 71 | assertThat( _sut, instanceOf( ProcessedCommandEvent ) ); 72 | assertThat( _sut, instanceOf( Event ) ); 73 | assertThat( _sut.type, equalTo( ProcessedCommandEvent.SUCCESS ) ); 74 | assertThat( _sut.result, arrayWithSize( 0 ) ); 75 | assertThat( _sut.bubbles, isFalse() ); 76 | assertThat( _sut.cancelable, isFalse() ); 77 | assertThat( _sut.eventPhase, EventPhase.AT_TARGET ); 78 | } 79 | 80 | [Test] 81 | public function should_clone():void 82 | { 83 | var clone:ProcessedCommandEvent = ( _sut.clone() as ProcessedCommandEvent ); 84 | 85 | assertThat( clone.type, equalTo( _sut.type ) ); 86 | assertThat( clone.result, equalTo( _sut.result ) ); 87 | assertThat( clone.bubbles, equalTo( _sut.bubbles ) ); 88 | assertThat( clone.cancelable, equalTo( _sut.cancelable ) ); 89 | assertThat( clone.eventPhase, allOf( equalTo( _sut.eventPhase ), equalTo( EventPhase.AT_TARGET ) ) ); 90 | } 91 | 92 | [Test] 93 | public function should_get_result():void 94 | { 95 | var result:Array = _sut.result; 96 | 97 | assertThat( result, arrayWithSize( 0 ) ); 98 | } 99 | 100 | [Test] 101 | public function should_set_result():void 102 | { 103 | var expectedResult:Array = ["hello"]; 104 | _sut.result = expectedResult; 105 | 106 | assertThat( _sut.result, equalTo(expectedResult)); 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /Cuke4AS3/test/com/flashquartermaster/cuke4as3/filesystem/WireFileParser_Test.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.filesystem 29 | { 30 | import com.flashquartermaster.cuke4as3.vo.ServerInfo; 31 | 32 | import flash.filesystem.File; 33 | 34 | import org.flexunit.assertThat; 35 | import org.hamcrest.object.equalTo; 36 | import org.hamcrest.object.instanceOf; 37 | import org.hamcrest.object.notNullValue; 38 | 39 | import support.FileHelper; 40 | 41 | public class WireFileParser_Test 42 | { 43 | 44 | private var _sut:WireFileParser; 45 | private var _fileHelper:FileHelper; 46 | 47 | [Before] 48 | public function setUp():void 49 | { 50 | _sut = new WireFileParser(); 51 | _fileHelper = new FileHelper(); 52 | } 53 | 54 | [After] 55 | public function tearDown():void 56 | { 57 | _sut.destroy(); 58 | _sut = null; 59 | _fileHelper.destroy(); 60 | _fileHelper = null; 61 | } 62 | 63 | [BeforeClass] 64 | public static function setUpBeforeClass():void 65 | { 66 | } 67 | 68 | [AfterClass] 69 | public static function tearDownAfterClass():void 70 | { 71 | } 72 | 73 | [Test] 74 | public function should_construct():void 75 | { 76 | assertThat( _sut, notNullValue() ); 77 | assertThat( _sut, instanceOf( WireFileParser ) ); 78 | } 79 | 80 | [Test (expects="ArgumentError") ] 81 | public function should_throw_argument_error_if_wire_file_srcDir_is_null():void 82 | { 83 | _sut.getServerInfoFromWireFile( null ); 84 | } 85 | 86 | [Test (expects="Error")] 87 | public function should_throw_error_if_wire_file_srcDir_is_empty():void 88 | { 89 | _sut.getServerInfoFromWireFile( "" ); 90 | } 91 | 92 | [Test (expects="ArgumentError") ] 93 | public function should_throw_argument_error_if_wire_file_srcDir_is_invalid():void 94 | { 95 | _sut.getServerInfoFromWireFile( "blah" + File.separator + "blah blah" + File.separator ); 96 | } 97 | 98 | [Test (expects="Error") ] 99 | public function tshould_throw_error_if_wire_file_srcDir_is_valid_but_no_wire_file_exists():void 100 | { 101 | _sut.getServerInfoFromWireFile( _fileHelper.getValidTmpDirectory() ); 102 | } 103 | } 104 | } -------------------------------------------------------------------------------- /Cuke4AS3/test/com/flashquartermaster/cuke4as3/net/CommandProcessor_Test.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.net 29 | { 30 | import com.flashquartermaster.cuke4as3.reflection.StepInvoker; 31 | import com.flashquartermaster.cuke4as3.reflection.StepMatcher; 32 | 33 | import flash.events.EventDispatcher; 34 | 35 | import org.hamcrest.assertThat; 36 | import org.hamcrest.object.instanceOf; 37 | import org.hamcrest.object.isFalse; 38 | import org.hamcrest.object.isTrue; 39 | import org.hamcrest.object.notNullValue; 40 | 41 | public class CommandProcessor_Test 42 | { 43 | 44 | private var _sut:CommandProcessor; 45 | 46 | [Before] 47 | public function setUp():void 48 | { 49 | _sut = new CommandProcessor(); 50 | } 51 | 52 | [After] 53 | public function tearDown():void 54 | { 55 | _sut.destroy(); 56 | _sut = null; 57 | } 58 | 59 | [Test] 60 | public function should_construct():void 61 | { 62 | assertThat( _sut, notNullValue() ); 63 | assertThat( _sut, instanceOf( CommandProcessor ) ); 64 | assertThat( _sut, instanceOf( EventDispatcher ) ); 65 | } 66 | 67 | [Test] 68 | public function should_process_command():void 69 | { 70 | //This main functionality is covered in the command-processor.feature 71 | assertThat( true, isTrue() ); 72 | } 73 | 74 | [Test] 75 | public function should_destroy():void 76 | { 77 | _sut.destroy(); 78 | } 79 | 80 | //Accessors 81 | 82 | [Test] 83 | public function should_set_stepInvoker():void 84 | { 85 | var expectedResult:StepInvoker = new StepInvoker(); 86 | 87 | _sut.stepInvoker = expectedResult; 88 | } 89 | 90 | [Test] 91 | public function should_set_stepMatcher():void 92 | { 93 | var expectedResult:StepMatcher = new StepMatcher( new StepInvoker() ); 94 | 95 | _sut.stepMatcher = expectedResult; 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Cuke4AS3/test/com/flashquartermaster/cuke4as3/net/Cucumber_Test.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.net 29 | { 30 | import flash.events.Event; 31 | import flash.events.IOErrorEvent; 32 | import flash.events.ProgressEvent; 33 | import flash.net.Socket; 34 | 35 | import org.flexunit.assertThat; 36 | import org.hamcrest.collection.hasItem; 37 | import org.hamcrest.object.equalTo; 38 | import org.hamcrest.object.isTrue; 39 | import org.hamcrest.object.notNullValue; 40 | import org.hamcrest.object.nullValue; 41 | import org.hamcrest.object.strictlyEqualTo; 42 | 43 | public class Cucumber_Test 44 | { 45 | private var _sut:Cucumber; 46 | private var _socket:Socket; 47 | 48 | [Before] 49 | public function setUp():void 50 | { 51 | _socket = new Socket(); 52 | _sut = new Cucumber( _socket ); 53 | } 54 | 55 | [After] 56 | public function tearDown():void 57 | { 58 | _sut.destroy(); 59 | _sut = null; 60 | } 61 | 62 | [BeforeClass] 63 | public static function setUpBeforeClass():void 64 | { 65 | } 66 | 67 | [AfterClass] 68 | public static function tearDownAfterClass():void 69 | { 70 | } 71 | 72 | [Test] 73 | public function should_construct():void 74 | { 75 | assertThat( _sut.socket, notNullValue() ); 76 | assertThat( _sut.socket, strictlyEqualTo( _socket ) ); 77 | assertThat( _sut.socket.hasEventListener( Event.CONNECT ), isTrue() ); 78 | assertThat( _sut.socket.hasEventListener( ProgressEvent.SOCKET_DATA ), isTrue() ); 79 | } 80 | 81 | [Test] 82 | public function should_destroy():void 83 | { 84 | _sut.destroy(); 85 | 86 | assertThat( _sut.socket, nullValue() ); 87 | assertThat( _sut.rawSocketData, nullValue() ); 88 | } 89 | 90 | [Test] 91 | public function should_decode_json():void 92 | { 93 | var inputElement:String = "begin_scenario"; 94 | var input:String = "[\""+inputElement+"\"]\n"; 95 | var expectedResult:Array = ["begin_scenario"]; 96 | 97 | _sut.rawSocketData = input; 98 | 99 | var result:Array = _sut.jsonDecodeSocketData(); 100 | 101 | assertThat( result, equalTo( expectedResult ) ); 102 | assertThat( result, hasItem( inputElement ) ); 103 | } 104 | 105 | [Test] 106 | public function should_encode_and_send_json():void 107 | { 108 | _socket.connect("0.0.0.0.",54321); 109 | _socket.addEventListener( IOErrorEvent.IO_ERROR, onIOError ); 110 | _sut.jsonEncodeAndSend( ["success"] ); 111 | } 112 | 113 | protected function onIOError(event:IOErrorEvent):void 114 | { 115 | trace("Cucumber_Test : onIOError : From : test_jsonEncodeAndSend"); 116 | } 117 | 118 | //Accessors 119 | 120 | [Test] 121 | public function should_get_socket():void 122 | { 123 | assertThat( _sut.socket, notNullValue() ); 124 | assertThat( _sut.socket, strictlyEqualTo( _socket ) ); 125 | } 126 | 127 | [Test] 128 | public function should_get_rawSocketData():void 129 | { 130 | assertThat( _sut.rawSocketData, nullValue() ); 131 | } 132 | 133 | [Test] 134 | public function should_set_rawSocketData():void 135 | { 136 | var expectedResult:String = "[\"begin_scenario\"]\n"; 137 | 138 | _sut.rawSocketData = expectedResult; 139 | 140 | assertThat( _sut.rawSocketData, equalTo( expectedResult ) ); 141 | } 142 | } 143 | } -------------------------------------------------------------------------------- /Cuke4AS3/test/com/flashquartermaster/cuke4as3/net/support/Cuke4AS3Server_Fixture_Support.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.net.support 29 | { 30 | import com.flashquartermaster.cuke4as3.net.Cuke4AS3Server; 31 | 32 | import support.MockCommandProcessor; 33 | 34 | public class Cuke4AS3Server_Fixture_Support 35 | { 36 | private var _sut:Cuke4AS3Server; 37 | private var _o:Object = new Object(); 38 | 39 | public function Cuke4AS3Server_Fixture_Support( sut:Cuke4AS3Server, host:String, port:int ) 40 | { 41 | _sut = sut; 42 | fixtureSetUpForRunningServer( host, port ); 43 | } 44 | 45 | private function fixtureSetUpForRunningServer( host:String, port:int ):void 46 | { 47 | makeHostPortPassThroughData( host, port ); 48 | setHostAndPort(); 49 | setUpCommandProcessor(); 50 | } 51 | 52 | private function setUpCommandProcessor():void 53 | { 54 | _sut.commandProcessor = new MockCommandProcessor(); 55 | } 56 | 57 | private function makeHostPortPassThroughData( host:String, port:int ):void 58 | { 59 | _o.host = host; 60 | _o.port = port; 61 | } 62 | 63 | private function setHostAndPort():void 64 | { 65 | _sut.host = _o.host; 66 | _sut.port = _o.port; 67 | } 68 | 69 | //Accessors 70 | 71 | public function get passThroughData():Object 72 | { 73 | return _o; 74 | } 75 | 76 | } 77 | } -------------------------------------------------------------------------------- /Cuke4AS3/test/com/flashquartermaster/cuke4as3/process/ProcessExposer.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.process 29 | { 30 | import flash.desktop.NativeProcess; 31 | import flash.events.IEventDispatcher; 32 | import flash.filesystem.File; 33 | 34 | public class ProcessExposer extends Process 35 | { 36 | public function ProcessExposer(target:IEventDispatcher=null) 37 | { 38 | super(target); 39 | } 40 | 41 | public function get nativeProcess():NativeProcess 42 | { 43 | return _nativeProcess; 44 | } 45 | 46 | public function get processArgs():Vector. 47 | { 48 | return _processArgs; 49 | } 50 | 51 | public function get executable():File 52 | { 53 | return _executable; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Cuke4AS3/test/com/flashquartermaster/cuke4as3/vo/InvokeInfo_Test.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.vo 29 | { 30 | import org.hamcrest.assertThat; 31 | import org.hamcrest.object.equalTo; 32 | import org.hamcrest.object.instanceOf; 33 | import org.hamcrest.object.isFalse; 34 | import org.hamcrest.object.isTrue; 35 | import org.hamcrest.object.notNullValue; 36 | import org.hamcrest.object.nullValue; 37 | 38 | public class InvokeInfo_Test 39 | { 40 | private var _sut:InvokeInfo; 41 | 42 | [Before] 43 | public function setUp():void 44 | { 45 | _sut = new InvokeInfo(); 46 | } 47 | 48 | [After] 49 | public function tearDown():void 50 | { 51 | _sut.destroy(); 52 | _sut = null; 53 | } 54 | 55 | [Test] 56 | public function should_construct():void 57 | { 58 | assertThat( _sut, notNullValue() ); 59 | assertThat( _sut, instanceOf( InvokeInfo )); 60 | 61 | assertThat( _sut.errorMessage, nullValue()); 62 | assertThat( _sut.errorName, nullValue()); 63 | assertThat( _sut.errorTrace, nullValue()); 64 | 65 | assertThat( _sut.pendingMessage, nullValue()); 66 | 67 | assertThat( _sut.isError(), isFalse()) 68 | assertThat( _sut.isPending(), isFalse()) 69 | assertThat( _sut.isSuccess(), isTrue() ); 70 | } 71 | 72 | [Test] 73 | public function should_indicate_error():void 74 | { 75 | _sut.errorMessage = "An error"; 76 | 77 | assertThat( _sut.isError(), isTrue() ); 78 | assertThat( _sut.isPending(), isFalse() ); 79 | assertThat( _sut.isSuccess(), isFalse() ); 80 | } 81 | 82 | [Test] 83 | public function should_indicate_pending():void 84 | { 85 | _sut.pendingMessage = "some message"; 86 | 87 | assertThat( _sut.isPending(), isTrue() ); 88 | assertThat( _sut.isError(), isFalse() ); 89 | assertThat( _sut.isSuccess(), isFalse() ); 90 | } 91 | 92 | [Test] 93 | public function should_indicate_success():void 94 | { 95 | assertThat( _sut.isSuccess(), isTrue() ); 96 | assertThat( _sut.isPending(), isFalse() ); 97 | assertThat( _sut.isError(), isFalse() ); 98 | } 99 | 100 | [Test] 101 | public function should_destroy():void 102 | { 103 | _sut.errorMessage = ""; 104 | _sut.errorName = ""; 105 | _sut.errorTrace = ""; 106 | 107 | _sut.pendingMessage = ""; 108 | 109 | _sut.destroy(); 110 | 111 | assertThat( _sut.errorMessage, nullValue()); 112 | assertThat( _sut.errorName, nullValue()); 113 | assertThat( _sut.errorTrace, nullValue()); 114 | 115 | assertThat( _sut.pendingMessage, nullValue()); 116 | 117 | assertThat( _sut.isError(), isFalse()) 118 | assertThat( _sut.isPending(), isFalse()) 119 | assertThat( _sut.isSuccess(), isTrue() ); 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /Cuke4AS3/test/com/flashquartermaster/cuke4as3/vo/MatchInfo_Test.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.vo 29 | { 30 | import flashx.textLayout.debug.assert; 31 | 32 | import org.hamcrest.assertThat; 33 | import org.hamcrest.object.equalTo; 34 | import org.hamcrest.object.instanceOf; 35 | import org.hamcrest.object.isFalse; 36 | import org.hamcrest.object.isTrue; 37 | import org.hamcrest.object.notNullValue; 38 | import org.hamcrest.object.nullValue; 39 | 40 | public class MatchInfo_Test 41 | { 42 | private var _sut:MatchInfo; 43 | 44 | [Before] 45 | public function setUp():void 46 | { 47 | _sut = new MatchInfo(); 48 | } 49 | 50 | [After] 51 | public function tearDown():void 52 | { 53 | _sut.destroy(); 54 | _sut = null; 55 | } 56 | 57 | [Test] 58 | public function should_construct():void 59 | { 60 | assertThat( _sut, notNullValue() ); 61 | assertThat( _sut, instanceOf( MatchInfo )); 62 | 63 | assertThat( _sut.errorMessage, nullValue()); 64 | assertThat( _sut.id, equalTo(-1)); 65 | assertThat( _sut.args, nullValue()); 66 | assertThat( _sut.className, nullValue()); 67 | assertThat( _sut.regExp, nullValue()); 68 | 69 | assertThat( _sut.isError(), isFalse()) 70 | assertThat( _sut.isMatch(), isFalse()) 71 | assertThat( _sut.isUndefined(), isTrue() ); 72 | } 73 | 74 | [Test] 75 | public function should_indicate_error():void 76 | { 77 | _sut.errorMessage = "An error"; 78 | 79 | assertThat( _sut.isError(), isTrue() ); 80 | assertThat( _sut.isMatch(), isFalse()) 81 | assertThat( _sut.isUndefined(), isFalse() ); 82 | } 83 | 84 | [Test] 85 | public function should_indicate_a_match():void 86 | { 87 | _sut.id = 4; 88 | 89 | assertThat( _sut.isMatch(), isTrue() ); 90 | assertThat( _sut.isError(), isFalse()) 91 | assertThat( _sut.isUndefined(), isFalse() ); 92 | } 93 | 94 | [Test] 95 | public function should_indicate_undefined_step():void 96 | { 97 | assertThat( _sut.isUndefined(), isTrue() ); 98 | assertThat( _sut.isError(), isFalse()) 99 | assertThat( _sut.isMatch(), isFalse()) 100 | } 101 | 102 | [Test] 103 | public function should_destroy():void 104 | { 105 | _sut.errorMessage = ""; 106 | _sut.id = 4; 107 | _sut.args = [{val:"some value",pos:12}]; 108 | _sut.className = "com.some.ClassType" 109 | _sut.regExp = "I do \"([^\"]*)\""; 110 | 111 | _sut.destroy(); 112 | 113 | assertThat( _sut.errorMessage, nullValue()); 114 | assertThat( _sut.id, equalTo(-1)); 115 | assertThat( _sut.args, nullValue()); 116 | assertThat( _sut.className, nullValue()); 117 | assertThat( _sut.regExp, nullValue()); 118 | 119 | assertThat( _sut.isError(), isFalse()) 120 | assertThat( _sut.isMatch(), isFalse()) 121 | assertThat( _sut.isUndefined(), isTrue() ); 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /Cuke4AS3/test/com/flashquartermaster/cuke4as3/vo/ServerInfo_Test.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.vo 29 | { 30 | import org.flexunit.assertThat; 31 | import org.hamcrest.object.equalTo; 32 | import org.hamcrest.object.instanceOf; 33 | import org.hamcrest.object.notNullValue; 34 | import org.hamcrest.object.nullValue; 35 | 36 | public class ServerInfo_Test 37 | { 38 | private var _sut:ServerInfo; 39 | 40 | [Before] 41 | public function setUp():void 42 | { 43 | _sut = new ServerInfo(); 44 | } 45 | 46 | [After] 47 | public function tearDown():void 48 | { 49 | _sut.destroy(); 50 | _sut = null; 51 | } 52 | 53 | [BeforeClass] 54 | public static function setUpBeforeClass():void 55 | { 56 | } 57 | 58 | [AfterClass] 59 | public static function tearDownAfterClass():void 60 | { 61 | } 62 | 63 | [Test] 64 | public function should_construct():void 65 | { 66 | assertThat( _sut, notNullValue() ); 67 | assertThat( _sut, instanceOf( ServerInfo ) ); 68 | } 69 | 70 | [Test] 71 | public function should_destroy():void 72 | { 73 | _sut.destroy(); 74 | 75 | assertThat( _sut.host, nullValue() ); 76 | assertThat( _sut.port, equalTo( 0 ) ); 77 | } 78 | 79 | [Test] 80 | public function should_get_host():void 81 | { 82 | //Test default host 83 | assertThat( _sut.host, equalTo( "0.0.0.0" ) ); 84 | } 85 | 86 | [Test] 87 | public function should_set_host():void 88 | { 89 | var host:String = "127.0.0.1" 90 | _sut.host = host; 91 | assertThat( _sut.host, equalTo( host ) ); 92 | } 93 | 94 | [Test] 95 | public function should_get_port():void 96 | { 97 | assertThat( _sut.port, equalTo( 54321 ) ); 98 | } 99 | 100 | [Test] 101 | public function should_set_port():void 102 | { 103 | var port:int = 8081; 104 | _sut.port = port; 105 | assertThat( _sut.port, equalTo( port ) ); 106 | } 107 | } 108 | } -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/asunit.feature: -------------------------------------------------------------------------------- 1 | @unit_testing @asunit @wip 2 | Feature: Unit Testing for ASUnit 3 | In order to make make unit test style assertions 4 | and leverage Asynchronous support 5 | I want to be able to support ASUnit -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/command-processor.feature: -------------------------------------------------------------------------------- 1 | @wire_protocol @command_processor 2 | Feature: The Command Processor 3 | In order to process commands sent from cucumber using the wire protocol 4 | I want to use a command processor that accepts a command and some data 5 | 6 | Background: 7 | Given a valid command processor 8 | 9 | Scenario Outline: Process Begin Scenario Command 10 | When I send a valid 11 | Then I receive 12 | 13 | Examples: 14 | | request | response | 15 | | ["begin_scenario"] | ["success"] | 16 | | ["begin_scenario", {"tags":["bar","baz","foo"]}] | ["success"] | 17 | 18 | Scenario Outline: Process Match Step Command 19 | When I send a valid 20 | Then I receive 21 | 22 | Examples: 23 | | request | response | 24 | | ["step_matches",{"name_to_match":"An undefined step"}] | ["success",[]] | 25 | | ["step_matches",{"name_to_match":"I have entered 6 into the calculator"}] | ["success",[{"id":"0", "args":[{"val":6, "pos": 15}], "source":"features.step_definitions.Calculator_Steps", "regexp":"/^I have entered (\\d+) into the calculator$/g"}]] | 26 | 27 | Scenario Outline: Process Invoke Command 28 | When I send a valid 29 | Then I receive 30 | 31 | Examples: 32 | | request | response | 33 | | ["invoke",{"id":"0","args":[]}] | ["success"] | 34 | | ["invoke",{"id":"0","args":["wired"]}] | ["success"] | 35 | | ["invoke",{"id":"0","args":["we're",[["wired"],["high"],["happy"]]]}] | ["success"] | 36 | | ["invoke",{"id":"1","args":[]}] | ["fail",{"message":"The wires are down", "exception":"Error"}] | 37 | | ["invoke",{"id":"2","args":[]}] | ["pending", "I'll do it later"] | 38 | 39 | Scenario Outline: Process End Scenario Command 40 | When I send a valid 41 | Then I receive 42 | 43 | Examples: 44 | | request | response | 45 | | ["end_scenario"] | ["success"] | 46 | | ["end_scenario", {"tags":["bar","baz","foo"]}] | ["success"] | 47 | 48 | Scenario Outline: Process Snippet Text Command 49 | When I send a valid 50 | Then I receive: 51 | """ 52 | ["success","[Given (/^we're all wired$/)]\npublic function should_we_re_all_wired():void\n{\n\tthrow new Pending(\"Awaiting implementation\");\n}"] 53 | """ 54 | 55 | Examples: 56 | | request | 57 | | ["snippet_text",{"step_keyword":"Given","multiline_arg_class":"","step_name":"we're all wired"}] | 58 | 59 | Scenario Outline: Invalid Command 60 | When I send an invalid 61 | Then I receive an error 62 | 63 | Examples: 64 | | request | 65 | | ["load_of_old_twaddle"] | -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/compiler.feature: -------------------------------------------------------------------------------- 1 | @compiler 2 | Feature: Running the ActionScript Compiler 3 | In order to compile actionscript step definitions 4 | I want to be able to run the actionscript compiler 5 | 6 | Background: 7 | Given I have initialised the compiler correctly 8 | 9 | Scenario: Compiler Happy Path 10 | When I run the compiler against good code 11 | Then compiler reports its progress 12 | And compiler exits cleanly and reports success 13 | 14 | Scenario: Compiler Error 15 | When I run the compiler against bad code 16 | Then compiler reports its progress 17 | Then compiler exits cleanly and reports errors 18 | 19 | Scenario: Additional arguments for compiler 20 | Given I have added valid additional compiler arguments 21 | When I run the compiler against good code 22 | Then compiler reports its progress 23 | Then compiler exits cleanly and reports success 24 | 25 | #Use bundled Dconsole 26 | #cuke4AS3.compilerProcess.isUseBundledDConsole = true; 27 | #Use bundled Flexunit 28 | #cuke4AS3.compilerProcess.isUseBundledFlexUnit = true; -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/core.feature: -------------------------------------------------------------------------------- 1 | @core 2 | Feature: Running the Completed Cuke4AS3 Application 3 | 4 | Considerations: 5 | Runs within an air application as a library 6 | Runs from commandline with adl: uses onInvoke to run 7 | Runs as installed app as air: uses onInvoke to run 8 | 9 | Notice: 10 | Core steps are primarily about how cucumber exits when 11 | connected or not to the wire server 12 | 13 | Background: 14 | Given Cuke4AS3 is set up correctly 15 | 16 | Scenario: Can run the Calculator example successfully 17 | When I run it against the Calculator example 18 | Then I receive events from the "compiler" 19 | And I receive events from the "swf loader" 20 | And I receive events from the "wire server" 21 | And I receive events from "cucumber" 22 | And Cuke4AS3 exits cleanly without error 23 | 24 | And the output from cucumber contains 25 | |2 scenarios (2 passed) | 26 | |8 steps (8 passed) | 27 | 28 | Scenario: Can listen for core errors 29 | When I run it without correctly configuring it 30 | Then an error is raised 31 | 32 | Scenario: No Scenarios are found to run so Cucumber never connects to the wire server 33 | When I run it against the Calculator example so that no scenarios run 34 | Then I receive events from the "compiler" 35 | And I receive events from the "swf loader" 36 | And I receive events from the "wire server" 37 | And I receive events from "cucumber" 38 | And Cuke4AS3 exits cleanly without error 39 | 40 | And the output from cucumber contains 41 | |0 scenarios | 42 | |0 steps | 43 | 44 | Scenario: Cucumber encounters fatal errors and ceases execution 45 | When I run it against the Bad Calculator example 46 | Then I receive events from the "compiler" 47 | And I receive events from the "swf loader" 48 | And I receive events from the "wire server" 49 | And I receive an error event from "cucumber" 50 | And Cuke4AS3 exits cleanly without error 51 | 52 | #Scenario: Can be stopped cleanly when executing -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/cucumber.feature: -------------------------------------------------------------------------------- 1 | @cucumber 2 | Feature: Running Cucumber 3 | In order to help ActionScript developers adopt cucumber 4 | and by running it last to make the process as robust as possible 5 | I want to be able to run cucumber as an integrated part of 6 | this application 7 | 8 | Background: 9 | Given I have initialised cucumber correctly 10 | 11 | Scenario: Cucumber Happy Path 12 | When I run cucumber with a valid directory structure and files 13 | Then cucumber reports its progress 14 | And cucumber exits cleanly and reports success 15 | 16 | Scenario: Cucumber Error 17 | When I run the cucumber against erroneous steps 18 | Then cucumber reports its progress 19 | Then cucumber exits cleanly and reports errors 20 | 21 | Scenario: Additional arguments for cucumber 22 | Given I have added valid additional cucumber arguments 23 | When I run cucumber with a valid directory structure and files 24 | Then cucumber reports its progress 25 | And cucumber exits cleanly and reports success -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/feature_files.feature: -------------------------------------------------------------------------------- 1 | @features 2 | Feature: Supporting the technical elements of a feature file 3 | As an implementer of the wire protocol 4 | I want to ensure that I support all the features expected of a feature file 5 | 6 | Background: 7 | Given I run background 8 | 9 | Scenario: First Scenario of two 10 | Given scenario one a 11 | Then scenario one b 12 | 13 | Scenario: Second Scenario of two but with a comment in it 14 | Given scenario two a 15 | #A comment 16 | Then scenario two b 17 | 18 | Scenario: Wild card scenario 19 | * scenario one a 20 | * scenario two a 21 | * scenario one b 22 | * scenario two b 23 | 24 | Scenario Outline: A Scenario Outline which uses two sets of examples 25 | Given I have entered 26 | And I have entered 27 | When I press add 28 | Then the current value should be 29 | 30 | Examples: First set of inputs 31 | | input_1 | input_2 | output | 32 | | 1 | 1 | 2 | 33 | | 2 | 2 | 4 | 34 | 35 | @second_set 36 | Examples: Second set of inputs 37 | | input_1 | input_2 | output | 38 | | 3 | 3 | 6 | 39 | | 4 | 4 | 8 | 40 | 41 | Scenario: Multiline table with single column 42 | Given the following single column table with 2 items 43 | 44 | | Item 1 | 45 | | Item 2 | 46 | 47 | Then the items in the table will be "Item 1" and "Item 2" 48 | 49 | Scenario: Multiline table with two columns where the top row are the headers 50 | Given the following table with headers 51 | 52 | | Column A | Column B | 53 | | Item A 1 | Item B 1 | 54 | | Item A 2 | Item B 2 | 55 | 56 | Then the headings will be "Column A" and "Column B" 57 | And the first item in "Column A" will be "Item A 1" 58 | And the second item in "Column A" will be "Item A 2" 59 | And the first item in "Column B" will be "Item B 1" 60 | And the second item in "Column B" will be "Item B 2" 61 | 62 | Scenario: Multiline table where the first column contains the headers 63 | Given the following table with headers 64 | 65 | | Header A | Item A 1 | 66 | | Header B | Item B 1 | 67 | | Header C | Item C 1 | 68 | 69 | Then the headings will be "Header A" and "Header B" and "Header C" 70 | And the item for "Header A" will be "Item A 1" 71 | And the item for "Header B" will be "Item B 1" 72 | And the item for "Header C" will be "Item C 1" 73 | 74 | Scenario: Basic doc string 75 | Given the following doc string: 76 | """ 77 | I am the doc string content 78 | """ 79 | Then the doc string contained the "String" "I am the doc string content" 80 | 81 | Scenario: Multiline doc string 82 | Given the following doc string: 83 | """ 84 | I am the 85 | doc string 86 | content 87 | """ 88 | Then the doc string contained the "String" "I am the\ndoc string\ncontent" 89 | 90 | Scenario: Xml doc string 91 | Given the following doc string: 92 | """ 93 | some text 94 | """ 95 | Then the doc string contained the "String" "some text" 96 | And the doc string is valid "xml" 97 | And the "item" node "content" is "some text" 98 | And the "item" node "attribute" "name" is "dave" 99 | 100 | Scenario: Multiline Xml doc string 101 | Given the following doc string: 102 | """ 103 | 104 | some text 105 | 106 | """ 107 | Then the doc string contained the "String" "\n\tsome text\n" 108 | And the doc string is valid "xml" 109 | And the "item" node "content" is "some text" 110 | And the "item" node "attribute" "name" is "dave" 111 | 112 | Scenario: JSON doc string 113 | Given the following doc string: 114 | """ 115 | ["dave",{"number":1,"string":"String 1"}] 116 | """ 117 | Then the doc string contained the "String" "["dave",{"number":1,"string":"String 1"}]" 118 | And the doc string is valid "JSON" 119 | And the doc string is an "array" 120 | And the first item in the array is a "String" "dave" 121 | And the second item in the array is an "Object" 122 | And the attribute of the object called "number" is a "Number" "1" 123 | And the attribute of the object called "string" is a "String" "String 1" 124 | -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/flex_unit.feature: -------------------------------------------------------------------------------- 1 | @unit_testing @flex_unit 2 | Feature: Unit Testing for FlexUnit 3 | In order to make make unit test style assertions 4 | and leverage Asynchronous support 5 | I want to be able to support FlexUnit 6 | 7 | Background: 8 | Given an object that dispatches asynchronous events 9 | 10 | Scenario: FlexUnit Async, Async Handler 11 | When I listen for an event using an "Async Handler" 12 | Then I receive the specified event when it is dispatched 13 | 14 | Scenario: FlexUnit Async, Async Handler Timeout 15 | When I listen for an event using an "Async Handler" that will timeout 16 | Then the timeout method is called 17 | 18 | Scenario: FlexUnit Async, Handle Event 19 | When I listen for an event using "Handle Event" 20 | Then I receive the specified event when it is dispatched 21 | 22 | Scenario: FlexUnit Async, Handle Event Timeout 23 | When I listen for an event using "Handle Event" that will timeout 24 | Then the timeout method is called 25 | 26 | Scenario: FlexUnit Async, Delay Call 27 | When I delay a call for 1 second 28 | Then the delayed call handler is called after 1 second 29 | 30 | Scenario: FlexUnit Async, Fail On Event 31 | When I listen for an event using "Fail on event" 32 | Then I receive the specified event when it is dispatched 33 | 34 | Scenario: FlexUnit Async, Fail On Event Timeout 35 | When I listen for an event using "Fail on event" that will timeout 36 | Then the timeout method is called 37 | 38 | Scenario: FlexUnit Async, Proceed On Event 39 | When I listen for an event using "Proceed on event" 40 | Then there is no timeout 41 | 42 | Scenario: FlexUnit Async, Proceed On Event Timeout 43 | When I listen for an event using "Proceed on event" that will timeout 44 | Then the timeout method is called 45 | 46 | Scenario: FlexUnit Async, Register Failure Event 47 | When I listen for an event using "Register failure event" 48 | Then I do not receive the specified event 49 | 50 | Scenario: Flex SDK Async Responder 51 | When I listen for an event using "Async Responder" 52 | Then I receive the specified event when it is dispatched 53 | 54 | Scenario: Flex SDK Async Responder Timeout 55 | When I listen for an event using "Async Responder" that will timeout 56 | Then the timeout method is called 57 | 58 | Scenario: Flex SDK Async Native Responder 59 | When I listen for an event using "Async Native Responder" 60 | Then I receive the specified event when it is dispatched 61 | 62 | Scenario: Flex SDK Async Native Responder Timeout 63 | When I listen for an event using "Async Native Responder" that will timeout 64 | Then the timeout method is called 65 | 66 | Scenario: Sequence runner 67 | When I use a sequence runner 68 | Then the sequence completes successfully 69 | 70 | Scenario: Other - Assume, dataprovider, theories, parameterised 71 | When assume, dataprovider, theories and parameterised -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/hamcrest.feature: -------------------------------------------------------------------------------- 1 | @unit_testing @hamcrest @wip 2 | Feature: Unit Testing for Hamcrest 3 | In order to make make unit test style assertions 4 | I want to be able to support Hamcrest 5 | 6 | Scenario: Hamcest assertThat 7 | 8 | Scenario: Hamcest assertThat Arrays 9 | 10 | Scenario: Hamcest assertThat Dates 11 | 12 | Scenario: Hamcest assertThat Numbers 13 | 14 | Scenario: Hamcest assertThat Object 15 | 16 | Scenario: Hamcest assertThat String -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/server-only.feature: -------------------------------------------------------------------------------- 1 | @core @reflection @net 2 | Feature: Running Cuke4AS3 in Server Only mode 3 | In order to run cuke4As3 in server only mode because I am working with cucumber some other way (e.g. command line) 4 | and in no-compile mode because I am compiling my step definitions some other way 5 | I want to be able to run the the system just using the 'net' and 'reflection' packages 6 | 7 | Scenario: Happy Path 8 | Given a valid swf is loaded 9 | And the loaded swf is processed successfully 10 | When I run the wire server on: 11 | | host | port | 12 | | 127.0.0.1 | 54322 | 13 | And cucumber connects to it 14 | Then I can match a step definition 15 | And I can invoke the code related to it 16 | And I know when cucumber has finished using me -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/server.feature: -------------------------------------------------------------------------------- 1 | @wire_server @net 2 | Feature: Running The Cuke4AS3 Wire Server 3 | In order to implement the wire protocol 4 | I need to have a server that cucumber can connect to 5 | 6 | Background: 7 | Given I have initialised the server on: 8 | | host | port | 9 | | 127.0.0.1 | 54323 | 10 | 11 | Scenario: Server Happy Path 12 | When I run the server 13 | Then it reports that it is running successfully 14 | 15 | Scenario: Happy Path with connection 16 | Given it is running successfully 17 | When cucumber connects to it 18 | Then cucumber communicates with the server 19 | 20 | Scenario: Sequential connections 21 | Given it is running successfully 22 | When cucumber connects to it 23 | And cucumber communicates with the server 24 | And cucumber closes its connection 25 | And cucumber reconnects to it 26 | Then cucumber communicates with the server 27 | 28 | Scenario: Accept multiple connections 29 | #TODO 30 | 31 | #Running against multiple projects can mean that the wire 32 | #file contents change so the server need to adapt to this 33 | 34 | Scenario Outline: Change host and port information 35 | Given it is running successfully 36 | When I specify a different of 37 | And I run the server 38 | Then the server listens on 39 | 40 | Examples: 41 | | item | value | 42 | | host | 0.0.0.0 | 43 | | port | 54324 | 44 | | host & port | 0.0.0.0:54325 | 45 | 46 | -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/step-invoker.feature: -------------------------------------------------------------------------------- 1 | @reflection @step_invoker 2 | Feature: Running ActionScript on the fly 3 | As a wire server, when cucumber asks me 4 | I want to be able to request that a step definition be executed 5 | and find out if it is successful, pending or a failure 6 | 7 | Background: 8 | Given the step invoker is set up correctly 9 | 10 | Scenario: Step definition is executed successfully 11 | When I ask it to execute some ActionScript successfully 12 | Then I receive relevant information about the code execution 13 | 14 | Scenario: Step definition is executed and fails 15 | When I ask it to execute some ActionScript that fails 16 | Then I receive relevant information about the code execution 17 | 18 | Scenario: Step definition is executed and is pending 19 | When I ask it to execute some ActionScript that is pending 20 | Then I receive relevant information about the code execution -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/step-matcher.feature: -------------------------------------------------------------------------------- 1 | @reflection @step_matcher 2 | Feature: Matching Step Definitions 3 | As a wire server, when cucumber asks me 4 | I want to be able to request a match for a step 5 | and to be told if a step is undefined or if it has invokable code behind it 6 | 7 | Background: 8 | Given I have set up the step matcher correctly 9 | 10 | Scenario: Finding an undefined step 11 | When I ask for an undefined step 12 | Then I receive the correct information about the step 13 | 14 | Scenario: Finding a defined step 15 | When I ask for a defined step 16 | Then I receive the correct information about the step 17 | 18 | Scenario: Finding an ambiguous step match 19 | When I ask for a defined step that can be matched more than once 20 | Then I receive the correct information about the step -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/swf-loader.feature: -------------------------------------------------------------------------------- 1 | @swf_loader 2 | Feature: Loading Compiled Swfs as a Binary 3 | In order to be able to get references to step definitions 4 | I want to be able to load a compiled swf that contains step definitions from the filesystem as a binary 5 | 6 | Background: 7 | Given I have initialised the swfloader correctly 8 | 9 | Scenario: SWF Loader Happy Path 10 | Given I have added a valid path to a swf 11 | When I run it I can tell it is running 12 | #There is no Then step to check it is running because it executes so fast it has 13 | #stopped by the time the method runs 14 | And on completion it exits cleanly and reports success 15 | 16 | Scenario: An io error occurs 17 | Given I have added an invalid path to a swf 18 | When I run it I can tell it is running 19 | And on completion it exits cleanly and reports the error 20 | 21 | # Scenario: A security error occurs 22 | # Given I have added a valid path to a swf outside the security sandbox 23 | # When I run it 24 | # Then I can tell it is running 25 | # And on completion it exits cleanly and reports the error -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/swf-processor.feature: -------------------------------------------------------------------------------- 1 | @reflection @swf_processor 2 | Feature: Processing and Analysing The Contents of a Swf 3 | In order to be able to match step definitions when cucumber asks for them 4 | I want to be able to analyse the step definitions and store them for future reference 5 | 6 | Background: 7 | Given I have initialised the swf processor correctly 8 | And a loaded swf containing step definitions 9 | 10 | Scenario: SWF Processor Happy Path 11 | When I process the loaded classes 12 | Then I will have steps for cucumber to match 13 | And it will exit cleanly and confirm success 14 | 15 | #Is this a millstone or a necessity? 16 | Scenario: An error occurs because you have not added a steps class to the suite 17 | Given an ActionScript class file is missing from the suite of step definitions 18 | When I process the loaded classes 19 | Then it will exit cleanly and confirm that the class is missing -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/ui_test_environment.feature: -------------------------------------------------------------------------------- 1 | @unit_testing @ui 2 | Feature: Fluint UI Test Environment 3 | I want to be able to add visual assets 4 | In order to verify their behavior 5 | 6 | Scenario: Add Sprite to Display List 7 | Given I have a visible asset 8 | When I add it to the UI test environment 9 | Then it can be seen -------------------------------------------------------------------------------- /Cuke4AS3/test/features/cuke4as3/wire-file.feature: -------------------------------------------------------------------------------- 1 | @wire_file 2 | Feature: Parsing the Wire File 3 | In order to run the wire server at the correct address 4 | I want to read the wire file 5 | 6 | Scenario: Wire File Parser Happy Path 7 | Given I have a wire file containing: 8 | """ 9 | host: localhost 10 | port: 54321 11 | """ 12 | When I parse it 13 | Then the results are: 14 | | host | port | 15 | | 127.0.0.1 | 54321 | 16 | 17 | #Cannot support ERB right now because AIR has no access to 18 | #environment variables. 19 | #Might be able to do something with a native extension though 20 | 21 | #Scenario: ERB support 22 | # Given I have a wire file containing: 23 | # """ 24 | # host: localhost 25 | # port: <%= ENV['PORT'] || 12345 %> 26 | # """ 27 | # And the environment setting for PORT is 54321 28 | # When I parse it 29 | # Then the results are: 30 | # | host | port | 31 | # | 127.0.0.1 | 54321 | -------------------------------------------------------------------------------- /Cuke4AS3/test/features/step_definitions/Cuke4AS3_Suite.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package features.step_definitions 29 | { 30 | import features.step_definitions.*; 31 | import flash.display.Sprite; 32 | 33 | public class Cuke4AS3_Suite extends Sprite 34 | { 35 | public function Cuke4AS3_Suite() 36 | { 37 | var ui:UI_Test_Environment_Steps; 38 | var features:Feature_Files_Steps; 39 | var wire_protocol:Wire_Protocol_Steps; 40 | var core:Core_Steps; 41 | var compiler:Compiler_Steps; 42 | var swfloader:SwfLoader_Steps; 43 | var swfprocessor:SwfProcessor_Steps; 44 | var server:Server_Steps; 45 | var wirefile:WireFile_Steps; 46 | var cucumber:Cucumber_Steps; 47 | var stepmatcher:StepMatcher_Steps; 48 | var stepinvoker:StepInvoker_Steps; 49 | var serverOnly:ServerOnly_Steps; 50 | var flexunit:FlexUnit_Steps; 51 | var commandprocessor:CommandProcessor_Steps; 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Cuke4AS3/test/features/step_definitions/UI_Test_Environment_Steps.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package features.step_definitions 29 | { 30 | import com.flashquartermaster.cuke4as3.utilities.StepsBase; 31 | 32 | import flash.display.Sprite; 33 | import flash.events.Event; 34 | 35 | import org.flexunit.asserts.fail; 36 | import org.flexunit.async.Async; 37 | import org.fluint.uiImpersonation.UIImpersonator; 38 | import org.hamcrest.assertThat; 39 | import org.hamcrest.object.isTrue; 40 | import org.hamcrest.object.notNullValue; 41 | 42 | public class UI_Test_Environment_Steps extends StepsBase 43 | { 44 | private var _sprite:Sprite; 45 | 46 | public function UI_Test_Environment_Steps() 47 | { 48 | super(); 49 | } 50 | 51 | [Given (/^I have a visible asset$/ )] 52 | public function createSprite():void 53 | { 54 | _sprite = new Sprite(); 55 | _sprite.graphics.beginFill( 0xFF0000 ); 56 | _sprite.graphics.drawRect( 0, 0, 100, 20 ); 57 | _sprite.graphics.endFill(); 58 | } 59 | 60 | [When ( /^I add it to the UI test environment$/, "async")] 61 | public function addToDisplayList():void 62 | { 63 | Async.proceedOnEvent( this, _sprite, Event.ADDED_TO_STAGE ); 64 | UIImpersonator.addChild( _sprite ); 65 | } 66 | 67 | [Then ( /^it can be seen$/ )] 68 | public function verifySprite():void 69 | { 70 | assertThat( _sprite.stage, notNullValue() ); 71 | assertThat( _sprite.visible, isTrue() ); 72 | 73 | // fail("To make sure that destroy() is called"); 74 | } 75 | 76 | override public function destroy():void 77 | { 78 | UIImpersonator.removeChild( _sprite ); 79 | _sprite = null; 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /Cuke4AS3/test/features/step_definitions/WireFile_Steps.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package features.step_definitions 29 | { 30 | import com.flashquartermaster.cuke4as3.filesystem.WireFileParser; 31 | import com.flashquartermaster.cuke4as3.utilities.Pending; 32 | import com.flashquartermaster.cuke4as3.utilities.StepsBase; 33 | import com.flashquartermaster.cuke4as3.utilities.Table; 34 | import com.flashquartermaster.cuke4as3.vo.ServerInfo; 35 | 36 | import org.hamcrest.assertThat; 37 | import org.hamcrest.object.equalTo; 38 | 39 | import support.FileHelper; 40 | 41 | public class WireFile_Steps extends StepsBase 42 | { 43 | private var _sut:WireFileParser; 44 | 45 | private var _fileHelper:FileHelper; 46 | private var _serverInfo:ServerInfo; 47 | 48 | public function WireFile_Steps() 49 | { 50 | } 51 | 52 | [Given(/^I have a wire file containing:$/)] 53 | public function should_have_wire_file_containing( docString:String ):void 54 | { 55 | _fileHelper = new FileHelper(); 56 | _fileHelper.makeValidWireFile( getHost( docString ), getPort( docString ) ); 57 | } 58 | 59 | [When(/^I parse it$/)] 60 | public function should_parse_it():void 61 | { 62 | _sut = new WireFileParser(); 63 | _serverInfo = _sut.getServerInfoFromWireFile( _fileHelper.getValidTmpDirectory() ); 64 | } 65 | 66 | [Then(/^the results are:$/)] 67 | public function the_results_should_be( array:Array ):void 68 | { 69 | var table:Table = new Table( array ); 70 | 71 | assertThat( _serverInfo.host, equalTo( table.getRowItemByHeader( "host", 0 ) ) ); 72 | assertThat( _serverInfo.port, equalTo( table.getRowItemByHeader( "port", 0 ) ) ); 73 | } 74 | 75 | [Given(/^the environment setting for PORT is (\d+)$/)] 76 | public function environment_setting_for_port_should_be( n1:Number ):void 77 | { 78 | throw new Pending( "Awaiting implementation" ); 79 | } 80 | 81 | override public function destroy():void 82 | { 83 | super.destroy(); 84 | 85 | _sut.destroy(); 86 | _sut = null; 87 | 88 | _fileHelper.destroy(); 89 | _fileHelper = null; 90 | 91 | _serverInfo = null; 92 | } 93 | 94 | //Support 95 | 96 | private function getPort( s:String ):int 97 | { 98 | var getPort:RegExp = /port:\s*?(\d+)$/gi; 99 | var port:Object = getPort.exec( s ); 100 | 101 | // Detect <%= ENV['PORT'] || 12345 %> and parse correctly 102 | 103 | return int( port[1] ); 104 | } 105 | 106 | private function getHost( s:String ):String 107 | { 108 | var getHost:RegExp = /host:\s*?(\S.*)/gi; 109 | var host:Object = getHost.exec( s ); 110 | return host[1]; 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /Cuke4AS3/test/features/step_definitions/Wire_Protocol_Steps.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package features.step_definitions 29 | { 30 | import com.flashquartermaster.cuke4as3.utilities.StepsBase; 31 | import com.furusystems.logging.slf4as.global.debug; 32 | 33 | import flash.filesystem.File; 34 | 35 | public class Wire_Protocol_Steps extends StepsBase 36 | { 37 | public function Wire_Protocol_Steps() 38 | { 39 | } 40 | 41 | private var _workingDir:File; 42 | 43 | // Background: 44 | // Given a standard Cucumber project directory structure 45 | [Given (/^a standard Cucumber project directory structure$/)] 46 | public function background_standardCucumberProjectStructure():void 47 | { 48 | debug( "*** Wire_Protocol_Steps : background_standardCucumberProjectStructure :",File.applicationDirectory.nativePath); 49 | _workingDir = File.applicationDirectory; 50 | 51 | var featuresDir:File = new File( _workingDir.nativePath + File.separator + "features" ); 52 | 53 | if( featuresDir.exists ) 54 | featuresDir.deleteDirectory( true ); 55 | 56 | featuresDir.createDirectory(); 57 | 58 | var stepsDir:File = new File( featuresDir.nativePath + File.separator + "step_definitions" ); 59 | stepsDir.createDirectory(); 60 | 61 | var supportDir:File = new File( featuresDir.nativePath + File.separator + "support" ); 62 | supportDir.createDirectory(); 63 | } 64 | 65 | // And a file named "features/step_definitions/some_remote_place.wire" with: 66 | [Given (/^a file named "([^"]*)" with:$/)] 67 | public function background_writeFileWith( fileName:String, fileContent:String ):void 68 | { 69 | debug( "*** Wire_Protocol_Steps : writeFileWith : ",fileName,fileContent); 70 | // var wireFile:File = new File( _workingDir 71 | } 72 | // Given /^a file named "([^"]*)" with:$/ do |file_name, file_content| 73 | // create_file(file_name, file_content) 74 | // end 75 | // """ 76 | // Feature: High strung 77 | // Scenario: Wired 78 | // Given we're all wired 79 | // 80 | // """ 81 | // And a file named "features/step_definitions/some_remote_place.wire" with: 82 | // """ 83 | // host: localhost 84 | // port: 54321 85 | // 86 | // """ 87 | 88 | override public function destroy():void 89 | { 90 | super.destroy(); 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /Cuke4AS3/test/features/step_definitions/cuke4AS3.wire: -------------------------------------------------------------------------------- 1 | host: localhost 2 | port: 54321 -------------------------------------------------------------------------------- /Cuke4AS3/test/features/support/FixtureConfig.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package features.support 29 | { 30 | public class FixtureConfig 31 | { 32 | public static var FLEX_HOME:String = "/Users/coxent01/Documents/flex_sdks/flex_sdk_4.5.1"; 33 | public static var MXMLC_EXE:String = FLEX_HOME + "/bin/mxmlc"; 34 | public static var CUCUMBER_EXE:String = "/usr/bin/cucumber"; 35 | 36 | public static var EXAMPLES_DIR:String = "/Users/coxent01/Documents/Cuke4AS3/Examples"; 37 | public static var EXAMPLE_CALCULATOR_DIR:String = EXAMPLES_DIR + "/Calculator/src"; 38 | public static var EXAMPLE_CALCULATOR_BAD_COMPILE_DIR:String = EXAMPLES_DIR + "/CalculatorBadCompile/src"; 39 | public static var EXAMPLE_CALCULATOR_BAD_CUCUMBER_DIR:String = EXAMPLES_DIR + "/CalculatorBadCucumber/src"; 40 | public static var EXAMPLE_CALCULATOR_NO_WIRE_DIR:String = EXAMPLES_DIR + "/CalculatorNoWire/src"; 41 | 42 | // public static var FLEX_HOME:String = "C:\\flex_sdks\\flex_sdk_4.5.1"; 43 | // public static var MXMLC_EXE:String = FLEX_HOME + "\\bin\\mxmlc.exe"; 44 | // public static var CUCUMBER_EXE:String = "C:\\Ruby192\\bin\\ruby.exe"; 45 | public static var WIN_CUCUMBER_EXE:String = "C:\\Ruby192\\bin\\cucumber"; 46 | // 47 | // public static var EXAMPLES_DIR:String = "C:\\Cuke4AS3\\Examples"; 48 | // public static var EXAMPLE_CALCULATOR_DIR:String = EXAMPLES_DIR + "\\Calculator\\src"; 49 | // public static var EXAMPLE_CALCULATOR_BAD_COMPILE_DIR:String = EXAMPLES_DIR + "\\CalculatorBadCompile\\src"; 50 | // public static var EXAMPLE_CALCULATOR_BAD_CUCUMBER_DIR:String = EXAMPLES_DIR + "\\CalculatorBadCucumber\\src"; 51 | // public static var EXAMPLE_CALCULATOR_NO_WIRE_DIR:String = EXAMPLES_DIR + "\\CalculatorNoWire\\src"; 52 | } 53 | } -------------------------------------------------------------------------------- /Cuke4AS3/test/support/Calculator_Support_Steps.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package support 29 | { 30 | public class Calculator_Support_Steps 31 | { 32 | public function Calculator_Support_Steps() 33 | { 34 | } 35 | 36 | // This matches the test data in the StepMatcher_Steps 37 | // for the duplicate step definition test 38 | [Given (/^I have entered (\d+) into the calculator$/g)] 39 | public function pushNumber( n:Number ):void 40 | { 41 | //Some implementation 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Cuke4AS3/test/support/MockCommandProcessor.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package support 29 | { 30 | import com.flashquartermaster.cuke4as3.events.ProcessedCommandEvent; 31 | import com.flashquartermaster.cuke4as3.net.CommandProcessor; 32 | import com.flashquartermaster.cuke4as3.net.ICommandProcessor; 33 | import com.flashquartermaster.cuke4as3.reflection.IStepInvoker; 34 | import com.flashquartermaster.cuke4as3.reflection.IStepMatcher; 35 | import com.flashquartermaster.cuke4as3.util.CucumberMessageMaker; 36 | 37 | import flash.events.EventDispatcher; 38 | 39 | public class MockCommandProcessor extends EventDispatcher implements ICommandProcessor 40 | { 41 | public function MockCommandProcessor() 42 | { 43 | } 44 | 45 | public function processCommand( action:String, data:Object ):void 46 | { 47 | if( action == CommandProcessor.BEGIN_SCENARIO || action == CommandProcessor.STEP_MATCHES 48 | || action == CommandProcessor.INVOKE || action == CommandProcessor.END_SCENARIO 49 | || action == CommandProcessor.SNIPPET_TEXT ) 50 | { 51 | dispatchEvent( new ProcessedCommandEvent( ProcessedCommandEvent.SUCCESS, CucumberMessageMaker.successMessage() ) ); 52 | } 53 | else 54 | { 55 | var msg:String = "Unknown Command : " + action + ", with data : " + data; 56 | dispatchEvent( new ProcessedCommandEvent( ProcessedCommandEvent.ERROR, [msg] ) ); 57 | } 58 | } 59 | 60 | public function destroy():void 61 | { 62 | } 63 | 64 | public function set stepMatcher( value:IStepMatcher ):void 65 | { 66 | } 67 | 68 | public function set stepInvoker( value:IStepInvoker ):void 69 | { 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Cuke4AS3/test/support/MockStepInvoker.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package support 29 | { 30 | import com.flashquartermaster.cuke4as3.events.InvokeMethodEvent; 31 | import com.flashquartermaster.cuke4as3.reflection.IStepInvoker; 32 | import com.flashquartermaster.cuke4as3.vo.InvokeInfo; 33 | 34 | import flash.events.EventDispatcher; 35 | import flash.system.ApplicationDomain; 36 | 37 | public class MockStepInvoker extends EventDispatcher implements IStepInvoker 38 | { 39 | public function MockStepInvoker() 40 | { 41 | } 42 | 43 | public function invoke( data:Object ):void 44 | { 45 | var invokeInfo:InvokeInfo = new InvokeInfo(); 46 | 47 | switch( data.id ) 48 | { 49 | case "1": 50 | invokeInfo.errorMessage = "The wires are down"; 51 | invokeInfo.errorName = "Error"; 52 | break; 53 | case "2": 54 | invokeInfo.pendingMessage = "I'll do it later"; 55 | break; 56 | } 57 | 58 | dispatchEvent( new InvokeMethodEvent( InvokeMethodEvent.RESULT, invokeInfo ) ); 59 | } 60 | 61 | public function getInvokationId( methodXml:XML ):uint 62 | { 63 | return 0; 64 | } 65 | 66 | public function set applicationDomain( applicationDomain:ApplicationDomain ):void 67 | { 68 | } 69 | 70 | public function get stepsObject():* 71 | { 72 | //just using this for the duplicate step match in the StepMatcher_Steps 73 | return ( new Calculator_Support_Steps() as Class ); 74 | } 75 | 76 | public function resetState():void 77 | { 78 | } 79 | 80 | public function isExecutingClass( declaredBy:String ):Boolean 81 | { 82 | return ( declaredBy == "support::Calculator_Support_Steps" ); 83 | } 84 | 85 | public function isExecutingScenario():Boolean 86 | { 87 | return true; 88 | } 89 | 90 | public function destroy():void 91 | { 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /Cuke4AS3/test/support/MockStepMatcher.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package support 29 | { 30 | import com.flashquartermaster.cuke4as3.reflection.IStepInvoker; 31 | import com.flashquartermaster.cuke4as3.reflection.IStepMatcher; 32 | import com.flashquartermaster.cuke4as3.vo.MatchInfo; 33 | 34 | import org.hamcrest.object.isFalse; 35 | 36 | public class MockStepMatcher implements IStepMatcher 37 | { 38 | private var _invokableStepsCalled:Boolean = false; 39 | 40 | public function MockStepMatcher( stepInvoker:IStepInvoker ) 41 | { 42 | } 43 | 44 | public function match( matchString:String ):MatchInfo 45 | { 46 | var matchInfo:MatchInfo = new MatchInfo(); 47 | 48 | if ( matchString == "I have entered 6 into the calculator") 49 | { 50 | matchInfo.id = 0//This is the id returned by the mock step invoker 51 | matchInfo.args = [{"val":6, "pos": 15}];//the number 6 will be found at character 15 in the string, this is for cucumbers highlighting 52 | matchInfo.className = "features.step_definitions.Calculator_Steps"; 53 | matchInfo.regExp = "/^I have entered (\\d+) into the calculator$/g"; 54 | } 55 | 56 | return matchInfo; 57 | } 58 | 59 | public function destroy():void 60 | { 61 | } 62 | 63 | public function get matchableSteps():XMLList 64 | { 65 | return null; 66 | } 67 | 68 | public function set matchableSteps( value:XMLList ):void 69 | { 70 | _invokableStepsCalled = true; 71 | } 72 | 73 | public function verifyInvokableSteps():Boolean 74 | { 75 | return _invokableStepsCalled; 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Cuke4AS3Lib/README: -------------------------------------------------------------------------------- 1 | Cuke4AS3Lib is a support library for writing step definitions comprising 2 | support for Booleans, tables, Pending notifications, a base class for 3 | step definitions and fairly dodgy ide metadata annotation 4 | 5 | ============ 6 | Release Info 7 | ============ 8 | 9 | Version 0.3.3 10 | ============= 11 | 12 | Added: Pending support 13 | 14 | Version 0.3.2 15 | ============= 16 | 17 | Table support for tables where the headers are the first column in the table -------------------------------------------------------------------------------- /Cuke4AS3Lib/cuke4as3lib-build.properties: -------------------------------------------------------------------------------- 1 | FLEX_HOME=../../flex_sdks/flex_sdk_4.5.1 2 | 3 | project.name=Cuke4as3Lib 4 | project.title=Cuke4AS3Lib 5 | 6 | src.dir=${basedir}/src 7 | tests.dir=${basedir}/test 8 | libs.dir=${basedir}/libs 9 | 10 | package.dir=com/flashquartermaster/cuke4as3 11 | 12 | output.dir=${basedir}/build 13 | docs.dir=${output.dir}/docs 14 | 15 | tests.runner=TestRunner 16 | tests.swf=${output.dir}/${tests.runner}.swf 17 | report.dir=${output.dir}/report 18 | 19 | bin.dir=${output.dir}/bin 20 | 21 | dist.dir=${basedir}/dist -------------------------------------------------------------------------------- /Cuke4AS3Lib/libs/flexUnitTasks-4.1.0-33.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3Lib/libs/flexUnitTasks-4.1.0-33.jar -------------------------------------------------------------------------------- /Cuke4AS3Lib/libs/flexunit-4.1.0-x-as3_y.y.y.y.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3Lib/libs/flexunit-4.1.0-x-as3_y.y.y.y.swc -------------------------------------------------------------------------------- /Cuke4AS3Lib/libs/flexunit-cilistener-4.1.0-33-3.5.0.12683.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3Lib/libs/flexunit-cilistener-4.1.0-33-3.5.0.12683.swc -------------------------------------------------------------------------------- /Cuke4AS3Lib/libs/flexunit-uilistener-4.1.0-33-3.5.0.12683.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3Lib/libs/flexunit-uilistener-4.1.0-33-3.5.0.12683.swc -------------------------------------------------------------------------------- /Cuke4AS3Lib/libs/flexunit_0.9.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3Lib/libs/flexunit_0.9.swc -------------------------------------------------------------------------------- /Cuke4AS3Lib/libs/hamcrest-as3-flex-1.1.3.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Cuke4AS3Lib/libs/hamcrest-as3-flex-1.1.3.swc -------------------------------------------------------------------------------- /Cuke4AS3Lib/src/Given.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package 29 | { 30 | public class Given 31 | { 32 | public function Given() 33 | { 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Cuke4AS3Lib/src/Then.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package 29 | { 30 | public class Then 31 | { 32 | public function Then() 33 | { 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Cuke4AS3Lib/src/When.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package 29 | { 30 | public class When 31 | { 32 | public function When() 33 | { 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Cuke4AS3Lib/src/com/flashquartermaster/cuke4as3/utilities/BooleanUtil.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.utilities 29 | { 30 | public class BooleanUtil 31 | { 32 | public function BooleanUtil() 33 | { 34 | } 35 | 36 | public static function evaluateString( s:String ):Boolean 37 | { 38 | if( s.toLowerCase() == "true") 39 | return true; 40 | else if( s.toLowerCase() == "false" ) 41 | return false; 42 | else 43 | throw new Error("BooleanUtil expected \"true\" or \"false\" but got " + s); 44 | } 45 | 46 | public static function evaluateNumber( n:Number ):Boolean 47 | { 48 | if( n == 1) 49 | return true; 50 | else if( n == 0 ) 51 | return false; 52 | else 53 | throw new Error("BooleanUtil expected 1 or 0 but got " + n); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Cuke4AS3Lib/src/com/flashquartermaster/cuke4as3/utilities/IStepsBase.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.utilities 29 | { 30 | public interface IStepsBase 31 | { 32 | function destroy():void 33 | } 34 | } -------------------------------------------------------------------------------- /Cuke4AS3Lib/src/com/flashquartermaster/cuke4as3/utilities/Pending.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.utilities 29 | { 30 | public class Pending extends Error 31 | { 32 | public function Pending( message:String = "" ) 33 | { 34 | super(message); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Cuke4AS3Lib/src/com/flashquartermaster/cuke4as3/utilities/StepsBase.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.utilities 29 | { 30 | public class StepsBase implements IStepsBase 31 | { 32 | public function StepsBase() 33 | { 34 | } 35 | 36 | public function destroy():void 37 | { 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Cuke4AS3Lib/src/metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 35 | 36 | 37 | 38 | 45 | 46 | -------------------------------------------------------------------------------- /Cuke4AS3Lib/test/TestRunner.mxml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Cuke4AS3Lib/test/com/flashquartermaster/cuke4as3/utilities/BooleanUtil_Test.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.utilities{ 29 | import com.flashquartermaster.cuke4as3.utilities.BooleanUtil; 30 | 31 | import org.flexunit.assertThat; 32 | import org.hamcrest.object.isFalse; 33 | import org.hamcrest.object.isTrue; 34 | 35 | public class BooleanUtil_Test 36 | { 37 | [Before] 38 | public function setUp():void 39 | { 40 | } 41 | 42 | [After] 43 | public function tearDown():void 44 | { 45 | } 46 | 47 | [BeforeClass] 48 | public static function setUpBeforeClass():void 49 | { 50 | } 51 | 52 | [AfterClass] 53 | public static function tearDownAfterClass():void 54 | { 55 | } 56 | 57 | [Test] 58 | public function should_evaluate_string_true_as_boolean_true():void 59 | { 60 | var s:String = "true"; 61 | var b:Boolean = BooleanUtil.evaluateString( s ); 62 | 63 | assertThat( b, isTrue() ); 64 | } 65 | 66 | [Test] 67 | public function should_evaluate_string_false_as_boolean_false():void 68 | { 69 | var s:String = "false"; 70 | var b:Boolean = BooleanUtil.evaluateString( s ); 71 | 72 | assertThat( b, isFalse() ); 73 | } 74 | 75 | [Test (expects="Error")] 76 | public function should_throw_an_error_for_invalid_input():void 77 | { 78 | var s:String = "garbage"; 79 | var b:Boolean = BooleanUtil.evaluateString( s ); 80 | } 81 | 82 | [Test] 83 | public function should_evaluate_number_1_to_true():void 84 | { 85 | var i:int = 1; 86 | var b:Boolean = BooleanUtil.evaluateNumber( i ); 87 | 88 | assertThat( b, isTrue() ); 89 | } 90 | 91 | [Test] 92 | public function should_evaluate_number_0_to_false():void 93 | { 94 | var i:int = 0; 95 | var b:Boolean = BooleanUtil.evaluateNumber( i ); 96 | 97 | assertThat( b, isFalse() ); 98 | } 99 | 100 | [Test (expects="Error")] 101 | public function should_throw_error_for_invalid_minus_number():void 102 | { 103 | var i:int = -1; 104 | var b:Boolean = BooleanUtil.evaluateNumber( i ); 105 | } 106 | 107 | [Test (expects="Error")] 108 | public function should_throw_error_for_invalid_number_higher_than_1():void 109 | { 110 | var i:int = 2; 111 | var b:Boolean = BooleanUtil.evaluateNumber( i ); 112 | } 113 | } 114 | } -------------------------------------------------------------------------------- /Cuke4AS3Lib/test/com/flashquartermaster/cuke4as3/utilities/StepsBase_Test.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package com.flashquartermaster.cuke4as3.utilities{ 29 | import com.flashquartermaster.cuke4as3.utilities.IStepsBase; 30 | import com.flashquartermaster.cuke4as3.utilities.StepsBase; 31 | 32 | import flexunit.framework.Assert; 33 | 34 | import org.flexunit.assertThat; 35 | import org.hamcrest.object.instanceOf; 36 | import org.hamcrest.object.notNullValue; 37 | import org.hamcrest.object.nullValue; 38 | 39 | public class StepsBase_Test 40 | { 41 | private var _sut:StepsBase; 42 | 43 | [Before] 44 | public function setUp():void 45 | { 46 | _sut = new StepsBase(); 47 | } 48 | 49 | [After] 50 | public function tearDown():void 51 | { 52 | _sut = null; 53 | } 54 | 55 | [BeforeClass] 56 | public static function setUpBeforeClass():void 57 | { 58 | } 59 | 60 | [AfterClass] 61 | public static function tearDownAfterClass():void 62 | { 63 | } 64 | 65 | [Test] 66 | public function should_construct():void 67 | { 68 | assertThat( _sut, notNullValue() ); 69 | assertThat( _sut, instanceOf( StepsBase ) ); 70 | assertThat( _sut, instanceOf( IStepsBase ) ); 71 | } 72 | 73 | [Test] 74 | public function should_destroy():void 75 | { 76 | //does not raise and error 77 | _sut.destroy(); 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /DeveloperUI/README: -------------------------------------------------------------------------------- 1 | Please refer to the wiki for a getting started guide: 2 | https://github.com/flashquartermaster/Cuke4AS3/wiki/How-To-Use-Cuke4AS3 3 | 4 | The DeveloperUI provides an easy way to get started with Cuke4AS3 and creates a visual environment to 5 | view your application as it runs from your step definitions. It integrates simple savable configuration 6 | and a view of the compiler and cucumber output for fast feedback when working with Cuke4AS3 on a day to 7 | day basis in a development environment. 8 | 9 | It contains helpful debugging info care of DConsole which is accessible by pressing ctrl + shift + Return. 10 | 11 | It also serves as a template for developing your own user interfaces that might do a lot more with the 12 | outputs from your step definitions e.g. Displaying some telemetry about your applications behavior. 13 | 14 | ============ 15 | Release Info 16 | ============ 17 | 18 | Version 0.4.3 19 | ============= 20 | 21 | Fixed: Button do not enable and disable correctly if no scenarios are run 22 | 23 | Version 0.4.2 24 | ============= 25 | 26 | Added: Keyboard short cuts. Ctrl + r to run, Ctrl + s to stop, Ctrl + c for config and Ctrl + o for output 27 | 28 | Version 0.4.1 29 | ============= 30 | 31 | Fixed: Cucumber can send angle brackets as part of its errors and consequently they do not show up in output windows 32 | Added: Pending steps should be highlighted in yellow 33 | Fixed: We are exiting on cucumber process complete rather than on client close from the server which is when cucumber says its done 34 | Fixed: Manage carriage returns on windows to improve formatting 35 | Fixed: Don't report cli colour highlighting error on windows 36 | Added: Scroll output as new text is put in 37 | Added: Show html output at the end of a run in a new window 38 | 39 | Version 0.4.0 40 | ============= 41 | 42 | Fixed: Formatting goes red if the word "error" is encountered, this is bad if that word is included in a scenario 43 | Fixed: Developer Installer is badly named it should start with Cuke4AS3 to be easily found in a list of installed applications 44 | 45 | Version 0.3.3 46 | ============= 47 | 48 | Fixed: Xml formatting does not appear correctly in the output window 49 | 50 | Version 0.3.2 51 | ============= 52 | 53 | Fixed: Server Errors not being reported -------------------------------------------------------------------------------- /DeveloperUI/assets/flexunit/flexunit-4.1.0-8-as3_4.1.0.16076.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/DeveloperUI/assets/flexunit/flexunit-4.1.0-8-as3_4.1.0.16076.swc -------------------------------------------------------------------------------- /DeveloperUI/assets/flexunit/flexunit_0.9.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/DeveloperUI/assets/flexunit/flexunit_0.9.swc -------------------------------------------------------------------------------- /DeveloperUI/assets/flexunit/hamcrest-as3-flex-1.1.3.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/DeveloperUI/assets/flexunit/hamcrest-as3-flex-1.1.3.swc -------------------------------------------------------------------------------- /DeveloperUI/assets/icons/icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/DeveloperUI/assets/icons/icon-16.png -------------------------------------------------------------------------------- /DeveloperUI/assets/icons/icon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/DeveloperUI/assets/icons/icon-32.png -------------------------------------------------------------------------------- /DeveloperUI/assets/icons/icon-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/DeveloperUI/assets/icons/icon-48.png -------------------------------------------------------------------------------- /DeveloperUI/developerui-build.properties: -------------------------------------------------------------------------------- 1 | FLEX_HOME=${basedir}/../../flex_sdks/flex_sdk_4.5.1 2 | #Specifiy basedir for FLEX_HOME because flexunit task gets confused 3 | #when writing out the descriptor xml for air when running this task 4 | #from the main build.xml in the parent directory 5 | ADL=${FLEX_HOME}/bin/adl 6 | ADT=${FLEX_HOME}/bin/adt 7 | ADT.JAR=${FLEX_HOME}/lib/adt.jar 8 | 9 | project.name=Cuke4AS3DeveloperUI 10 | project.title=Cuke4AS3DeveloperUI 11 | 12 | src.dir=${basedir}/src 13 | libs.dir=${basedir}/libs 14 | 15 | reverse.dns=com.flashquartermaster.cuke4as3 16 | 17 | output.dir=${basedir}/build 18 | 19 | bin.dir=${output.dir}/bin 20 | 21 | bundledlibs.dir=${output.dir}/bundled_libs 22 | bundledlibs.dconsole.dir=${bundledlibs.dir}/dconsole 23 | bundledlibs.flexunit.dir=${bundledlibs.dir}/flexunit 24 | 25 | app.descriptor=${output.dir}/${project.name}-app.xml 26 | 27 | assets.dir=${basedir}/assets 28 | 29 | dist.dir=${basedir}/dist -------------------------------------------------------------------------------- /DeveloperUI/libs/DConsole2SWC.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/DeveloperUI/libs/DConsole2SWC.swc -------------------------------------------------------------------------------- /DeveloperUI/libs/as3corelib.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/DeveloperUI/libs/as3corelib.swc -------------------------------------------------------------------------------- /DeveloperUI/libs/flexUnitTasks-4.1.0-33.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/DeveloperUI/libs/flexUnitTasks-4.1.0-33.jar -------------------------------------------------------------------------------- /DeveloperUI/libs/flexunit-4.1.0-x-as3_y.y.y.y.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/DeveloperUI/libs/flexunit-4.1.0-x-as3_y.y.y.y.swc -------------------------------------------------------------------------------- /DeveloperUI/libs/flexunit-cilistener-4.1.0-33-3.5.0.12683.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/DeveloperUI/libs/flexunit-cilistener-4.1.0-33-3.5.0.12683.swc -------------------------------------------------------------------------------- /DeveloperUI/libs/flexunit-uilistener-4.1.0-33-3.5.0.12683.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/DeveloperUI/libs/flexunit-uilistener-4.1.0-33-3.5.0.12683.swc -------------------------------------------------------------------------------- /DeveloperUI/libs/flexunit_0.9.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/DeveloperUI/libs/flexunit_0.9.swc -------------------------------------------------------------------------------- /DeveloperUI/libs/hamcrest-as3-flex-1.1.3.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/DeveloperUI/libs/hamcrest-as3-flex-1.1.3.swc -------------------------------------------------------------------------------- /DeveloperUI/test/features/step_definitions/Cuke4AS3_Suite.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package features.step_definitions 29 | { 30 | import flash.display.Sprite; 31 | 32 | public class Cuke4AS3_Suite extends Sprite 33 | { 34 | public function Cuke4AS3_Suite() 35 | { 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /DeveloperUI/test/features/step_definitions/developerui.wire: -------------------------------------------------------------------------------- 1 | host: localhost 2 | port: 54331 -------------------------------------------------------------------------------- /Examples/Calculator/libs/DConsole2SWC.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flashquartermaster/Cuke4AS3/b48b1fe3b85da1648997b2e8b26f8b026c24fb0e/Examples/Calculator/libs/DConsole2SWC.swc -------------------------------------------------------------------------------- /Examples/Calculator/src/Calculator.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package 29 | { 30 | import flash.display.Sprite; 31 | import flash.utils.describeType; 32 | 33 | public class Calculator extends Sprite 34 | { 35 | public var stack:Vector.; 36 | 37 | public function Calculator() 38 | { 39 | stack = new Vector.(); 40 | } 41 | 42 | public function push(n:Number):void 43 | { 44 | stack.push(n); 45 | } 46 | 47 | public function divide():Number 48 | { 49 | return stack[0] / stack[1]; 50 | } 51 | 52 | public function add():Number 53 | { 54 | return stack[0] + stack[1]; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Examples/Calculator/src/features/calculator.wire: -------------------------------------------------------------------------------- 1 | host: localhost 2 | port: 54345 -------------------------------------------------------------------------------- /Examples/Calculator/src/features/math.feature: -------------------------------------------------------------------------------- 1 | @math 2 | Feature: How to do math 3 | As a hopeless mathematician 4 | I want to be able to do some math 5 | 6 | @add 7 | Scenario: Adding two numbers 8 | Given I have entered 4 into the calculator 9 | And I have entered 1 into the calculator 10 | When I want it to add 11 | Then the current value should be 5 12 | 13 | @divide 14 | Scenario: Dividing two numbers 15 | Given I have entered 3 into the calculator 16 | And I have entered 2 into the calculator 17 | When I want it to divide 18 | Then the current value should be 1.5 -------------------------------------------------------------------------------- /Examples/Calculator/src/features/step_definitions/Calculator_Steps.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package features.step_definitions 29 | { 30 | public class Calculator_Steps 31 | { 32 | private var _calculator:Calculator; 33 | private var _calculatorResult:Number; 34 | 35 | public function Calculator_Steps() 36 | { 37 | _calculator = new Calculator(); 38 | } 39 | 40 | [Given(/^I have entered (\d+) into the calculator$/g)] 41 | public function pushNumber( n:Number ):void 42 | { 43 | _calculator.push( n ); 44 | } 45 | 46 | [When(/^I want it to (add|divide)$/)] 47 | public function pressButton( button:String ):void 48 | { 49 | if( button == "divide" ) 50 | { 51 | _calculatorResult = _calculator.divide(); 52 | } 53 | else if( button == "add" ) 54 | { 55 | _calculatorResult = _calculator.add(); 56 | } 57 | else 58 | { 59 | throw new Error( "Unknown operation : " + button ); 60 | } 61 | } 62 | 63 | [Then(/^the current value should be (.*)$/)] 64 | public function checkValue( value:Number ):void 65 | { 66 | if( _calculatorResult != value ) 67 | { 68 | throw new Error( "Expected " + value + ", but got " + _calculatorResult ); 69 | } 70 | } 71 | 72 | public function destroy():void 73 | { 74 | _calculator = null; 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /Examples/Calculator/src/features/step_definitions/Cuke4AS3_Suite.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package features.step_definitions 29 | { 30 | import flash.display.Sprite; 31 | 32 | public class Cuke4AS3_Suite extends Sprite 33 | { 34 | public var calculator_steps:Calculator_Steps; 35 | 36 | public function Cuke4AS3_Suite() 37 | { 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Examples/CalculatorBadCompile/src/Calculator.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package 29 | { 30 | import flash.display.Sprite; 31 | import flash.utils.describeType; 32 | 33 | public class Calculator extends Sprite 34 | { 35 | public var stack:Vector.; 36 | 37 | public function Calculator() 38 | { 39 | stack = new Vector.(); 40 | } 41 | 42 | public function push(n:Number):void 43 | { 44 | stack.push(n); 45 | } 46 | 47 | public function divide():Number 48 | { 49 | return stack[0] / stack[1]; 50 | } 51 | 52 | // public function add():Number 53 | // { 54 | // return stack[0] + stack[1]; 55 | // } 56 | } 57 | } -------------------------------------------------------------------------------- /Examples/CalculatorBadCompile/src/features/math.feature: -------------------------------------------------------------------------------- 1 | @math 2 | Feature: How to do math 3 | As a hopeless mathematician 4 | I want to be able to do some math 5 | 6 | @add 7 | Scenario: Adding two numbers 8 | Given I have entered 4 into the calculator 9 | And I have entered 1 into the calculator 10 | When I want it to add 11 | Then the current value should be 5 12 | 13 | @divide 14 | Scenario: Dividing two numbers 15 | Given I have entered 3 into the calculator 16 | And I have entered 2 into the calculator 17 | When I want it to divide 18 | Then the current value should be 1.5 -------------------------------------------------------------------------------- /Examples/CalculatorBadCompile/src/features/step_definitions/Calculator_Steps.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package features.step_definitions 29 | { 30 | import com.furusystems.logging.slf4as.global.debug; 31 | 32 | import flash.display.Sprite; 33 | 34 | import org.flexunit.Assert; 35 | import org.flexunit.asserts.fail; 36 | import org.hamcrest.assertThat; 37 | import org.hamcrest.core.not; 38 | import org.hamcrest.object.equalTo; 39 | 40 | public class Calculator_Steps 41 | { 42 | private var _calculator:Calculator; 43 | private var _calculatorResult:Number; 44 | 45 | public function Calculator_Steps() 46 | { 47 | _calculator = new Calculator(); 48 | } 49 | 50 | [Given(/^I have entered (\d+) into the calculator$/g)] 51 | public function pushNumber( n:Number ):void 52 | { 53 | _calculator.push( n ); 54 | } 55 | 56 | [When(/^I want it to (add|divide)$/)] 57 | public function pressButton( button:String ):void 58 | { 59 | if( button == "divide" ) 60 | { 61 | _calculatorResult = _calculator.divide(); 62 | return; 63 | } 64 | else if( button == "add" ) 65 | { 66 | _calculatorResult = _calculator.add(); 67 | return; 68 | } 69 | throw new Error("Unknown operation : " + button); 70 | } 71 | 72 | [Then(/^the current value should be (.*)$/)] 73 | public function checkValue( value:Number ):void 74 | { 75 | if (_calculatorResult != value) { 76 | throw new Error("Expected " + value + ", but got " + _calculatorResult); 77 | } 78 | } 79 | 80 | public function destroy():void 81 | { 82 | _calculator = null; 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /Examples/CalculatorBadCompile/src/features/step_definitions/Cuke4AS3_Suite.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package features.step_definitions 29 | { 30 | import flash.display.Sprite; 31 | 32 | public class Cuke4AS3_Suite extends Sprite 33 | { 34 | public var calculator_steps:Calculator_Steps; 35 | 36 | public function Cuke4AS3_Suite() 37 | { 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Examples/CalculatorBadCucumber/src/Calculator.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package 29 | { 30 | import flash.display.Sprite; 31 | import flash.utils.describeType; 32 | 33 | public class Calculator extends Sprite 34 | { 35 | public var stack:Vector.; 36 | 37 | public function Calculator() 38 | { 39 | stack = new Vector.(); 40 | } 41 | 42 | public function push(n:Number):void 43 | { 44 | stack.push(n); 45 | } 46 | 47 | public function divide():Number 48 | { 49 | return stack[0] / stack[1]; 50 | } 51 | 52 | public function add():Number 53 | { 54 | return stack[0] + stack[1]; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Examples/CalculatorBadCucumber/src/features/math.feature: -------------------------------------------------------------------------------- 1 | @math 2 | Feature: How to do math 3 | As a hopeless mathematician 4 | I want to be able to do some math 5 | 6 | @add 7 | Scenario: Adding two numbers 8 | Given I have entered 4 into the calculator 9 | And I have entered 1 into the calculator 10 | When I want it to add 11 | Then the current value should be 5 12 | 13 | @divide 14 | Scenario: Dividing two numbers 15 | Given I have entered 3 into the calculator 16 | And I have entered 2 into the calculator 17 | When I want it to divide 18 | Then the current value should be 1.5 -------------------------------------------------------------------------------- /Examples/CalculatorBadCucumber/src/features/step_definitions/Calculator_Steps.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package features.step_definitions 29 | { 30 | import com.furusystems.logging.slf4as.global.debug; 31 | 32 | import flash.display.Sprite; 33 | 34 | import org.flexunit.Assert; 35 | import org.flexunit.asserts.fail; 36 | import org.hamcrest.assertThat; 37 | import org.hamcrest.core.not; 38 | import org.hamcrest.object.equalTo; 39 | 40 | public class Calculator_Steps 41 | { 42 | private var _calculator:Calculator; 43 | private var _calculatorResult:Number; 44 | 45 | public function Calculator_Steps() 46 | { 47 | _calculator = new Calculator(); 48 | } 49 | 50 | [Given(/^I have entered (\d+) into the calculator$/g)] 51 | public function pushNumber( n:Number ):void 52 | { 53 | _calculator.push( n ); 54 | } 55 | 56 | [When(/^I want it to (add|divide)$/)] 57 | public function pressButton( button:String ):void 58 | { 59 | if( button == "divide" ) 60 | { 61 | _calculatorResult = _calculator.divide(); 62 | return; 63 | } 64 | else if( button == "add" ) 65 | { 66 | _calculatorResult = _calculator.add(); 67 | return; 68 | } 69 | throw new Error("Unknown operation : " + button); 70 | } 71 | 72 | [Then(/^the current value should be (.*)$/)] 73 | public function checkValue( value:Number ):void 74 | { 75 | if (_calculatorResult != value) { 76 | throw new Error("Expected " + value + ", but got " + _calculatorResult); 77 | } 78 | } 79 | 80 | public function destroy():void 81 | { 82 | _calculator = null; 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /Examples/CalculatorBadCucumber/src/features/step_definitions/Cuke4AS3_Suite.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 FlashQuartermaster Ltd 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * @author Tom Coxen 26 | * @version 27 | **/ 28 | package features.step_definitions 29 | { 30 | import flash.display.Sprite; 31 | 32 | public class Cuke4AS3_Suite extends Sprite 33 | { 34 | public var calculator_steps:Calculator_Steps; 35 | 36 | public function Cuke4AS3_Suite() 37 | { 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Examples/CalculatorBadCucumber/src/features/step_definitions/bad.wire: -------------------------------------------------------------------------------- 1 | host: localhost 2 | port: 0 -------------------------------------------------------------------------------- /Examples/CalculatorNoWire/src/features/math.feature: -------------------------------------------------------------------------------- 1 | @math 2 | Feature: How to do math 3 | As a hopeless mathematician 4 | I want to be able to do some math 5 | 6 | @add 7 | Scenario: Adding two numbers 8 | Given I have entered 4 into the calculator 9 | And I have entered 1 into the calculator 10 | When I want it to add 11 | Then the current value should be 5 12 | 13 | @divide 14 | Scenario: Dividing two numbers 15 | Given I have entered 3 into the calculator 16 | And I have entered 2 into the calculator 17 | When I want it to divide 18 | Then the current value should be 1.5 -------------------------------------------------------------------------------- /Examples/examples-build.properties: -------------------------------------------------------------------------------- 1 | FLEX_HOME=${basedir}/../../flex_sdks/flex_sdk_4.5.1 2 | #Specifiy basedir for FLEX_HOME because flexunit task gets confused 3 | #when writing out the descriptor xml for air when running this task 4 | #from the main build.xml in the parent directory 5 | ADL=${FLEX_HOME}/bin/adl 6 | ADT=${FLEX_HOME}/bin/adt 7 | ADT.JAR=${FLEX_HOME}/lib/adt.jar 8 | 9 | project.name=Examples 10 | project.title=Examples 11 | 12 | calculator.dir=${basedir}/Calculator 13 | calculator.src.dir=${calculator.dir}/src 14 | calculator.libs.dir=${calculator.dir}/libs 15 | 16 | calculator.badcompile.dir=${basedir}/CalculatorBadCompile 17 | calculator.badcucumber.dir=${basedir}/CalculatorBadCucumber 18 | calculator.nowire.dir=${basedir}/CalculatorNoWire 19 | 20 | selenium.dir=${basedir}/Selenium 21 | selenium.src.dir=${selenium.dir}/src 22 | selenium.libs.dir=${selenium.dir}/libs 23 | 24 | reports.dir=${basedir}/reports 25 | dist.dir=${basedir}/dist 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011 FlashQuartermaster Ltd 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is furnished 10 | to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Cuke4AS3 Developer allows ActionScript to be used for Cucumber step definitions 2 | 3 | Downloads: 4 | Get Everything - https://github.com/downloads/flashquartermaster/Cuke4AS3/Cuke4AS3-Everything-0.4.3-Alpha.zip 5 | Get The Presentation - https://github.com/downloads/flashquartermaster/Cuke4AS3/BDD_with_Cuke4AS3.zip 6 | 7 | Wiki Home: 8 | https://github.com/flashquartermaster/Cuke4AS3/wiki 9 | 10 | How to use Cuke4AS3 Developer UI: 11 | https://github.com/flashquartermaster/Cuke4AS3/wiki/How-To-Use-Cuke4AS3 12 | 13 | Please note you do not have to use the Developer UI but it can be helpful if you are starting out or as a primer. Cuke4AS3 is actually a library that you can implement your own UI over if you so wish or run in server only mode to 14 | sit alongside Cucumber: 15 | https://github.com/flashquartermaster/Cuke4AS3/blob/master/Cuke4AS3/README 16 | https://github.com/flashquartermaster/Cuke4AS3/blob/master/Cuke4AS3/test/features/cuke4as3/server-only.feature 17 | https://github.com/flashquartermaster/Cuke4AS3/blob/master/Cuke4AS3/test/features/step_definitions/ServerOnly_Steps.as 18 | 19 | Important info on how to work with the source code: 20 | https://github.com/flashquartermaster/Cuke4AS3/wiki/Working-With-The-Source 21 | 22 | Cuke4AS3 Documentation: 23 | 24 | Relish 25 | https://www.relishapp.com/flashquartermaster/cuke4as3/ 26 | 27 | Cuke4AS3Lib 28 | http://cuke4as3.flashquartermaster.com/lib/docs/ 29 | 30 | Cuke4AS3 31 | http://cuke4as3.flashquartermaster.com/core/docs/ 32 | 33 | Please Note: 34 | No contributions will be accepted unless they have accompanying unit tests and where necessary features and step definitions 35 | -------------------------------------------------------------------------------- /build.properties: -------------------------------------------------------------------------------- 1 | FLEX_HOME = ../flex_sdks/flex_sdk_4.5.1 2 | ADL=${FLEX_HOME}/bin/adl 3 | ADT_JAR=${FLEX_HOME}/lib/adt.jar 4 | 5 | #Windows only 6 | RUBY_EXE=C:/Ruby192/bin/ruby.exe 7 | CUCUMBER_EXE=C:/Ruby192/bin/cucumber 8 | #Nix only 9 | CUCUMBER_NIX=/usr/bin/cucumber 10 | NIX_FILE_EXT=dmg 11 | 12 | #Versioning 13 | version.num=0.4.3 14 | version.status=Alpha 15 | 16 | project.name=Cuke4AS3-Everything 17 | project.title=Cuke4AS3 Parent Project 18 | project.name.versioned=${project.name}-${version.num}-${version.status} 19 | 20 | dist.dir=${basedir}/dist 21 | 22 | #Projects 23 | cuke4as3.dir=${basedir}/Cuke4AS3 24 | cuke4as3Lib.dir=${basedir}/Cuke4AS3Lib 25 | cuke4as3Ui.dir=${basedir}/DeveloperUI 26 | 27 | #Examples 28 | cuke4as3Examples.dir=${basedir}/Examples 29 | 30 | #Certificate 31 | cert.keystore=certificate.p12 32 | cert.name=SelfSignedCertificate 33 | cert.orgunit=Software Development 34 | cert.orgname=FlashQuartermaster 35 | cert.country=GB 36 | cert.keytype=1024-RSA 37 | cert.password=password 38 | 39 | cert.storetype=pkcs12 --------------------------------------------------------------------------------