FlexUnit4(Beta1...)
   +Flexcover FlexMonkey
• @hikaruworld
•         Java

• Flex
• Javascript Python
1. FlexUnit4
2. Flexcover
3. FlexMonkey
UnitTesting

•FlexUnit4
• Flexcover
• FlexMonkey
                    etc...
UnitTesting

•FlexUnit4 Beta1
• Flexcover
• FlexMonkey
                    etc...
FlexUnit4 (Beta1)
•   2009/06/29        Beta ...

•   JUnit4

•   FlashBuilder4                ...

•
•   GUI

•   FlexUni...
http://bugs.adobe.com/
 jira/browse/FB-18873
http://bugs.adobe.com/
 jira/browse/FB-18873
• libs/FlexUnit1Lib.swc
• libs/FlexUnit4.swc
• libs/FlexUnit4UIRunner.swc
• libs/hamcrest-as3.swc
(GUI)
 • src/FlexUnit4Turnkey.mxml
      (                  OK.)
1. FlexUnitCore

2.                       addListener()

...
import flash.display.Sprite;
import org.flexunit.runner.FlexUnitCore;

public class FlexUnit4CUI extends Sprite
{
  public f...
JUnit4→FlexUnit4
•   @Test          •   [Test]

•   @Before        •   [Before]

•   @BeforeClass   •   [BeforeClass]

•  ...
flexunit.framework.*
org.flexunit.*
package {
  import org.flexunit.Assert;

    public class CalculateTest
    {
      private var target:Calculate
      {
  ...
Before and After

• [Test]          /

•            [async] [ui]

•          Before/After [Before(order=1)]
BeforeClass/AfterClass

•            /



•   static
Before/After
               →
Exception Handling

• [Test(expected=”                 ”)]

• expected throw                 Error


  ex)flash.errors.Ille...
[Test(expected=”flash.errors.IllegalOperationError”)]
public function exceptionTest():void
{
  throw new IllegalOperationEr...
Ignore
• [Ignore]
• [Test]
•

• [Ignore(“            ”)]
[Ignore(“                       ”)]
[Test]
public function ignoreTest():void
{
  //
}
Ignore
•   org.flexunit.flexui.TestRunnerBase.mxml
                      Ignore                ?

•
      I

•
7/2/2009 17:08:19.629 [INFO] FlexUnit4 ignore::IgnoreTest.
                        . ←
7/2/2009 17:08:19.632 [INFO] FlexUn...
Async
•   Async                   fluint



•   Before/After/Test

•   timeout=”           ”



•   [Test(async, timeout=”5...
[Test(async, timeout=”500”)]
public function                    ():void {
 var timer:Timer = new Timer(300, 1);
 timer.add...
Hamcrest

•
• Hamcrest              AS3

•
• assertThat(   ,   (     ))
http://github.com/drewbourne/
   hamcrest-as3/tree/master
•   Hamcrest-AS3              ?


•             ASDoc


•
•   Java     PHP


•   org.hamcrest.number
    org.hamcrest.text...
• assertThat(3, isA(3));
• assertThat(“hoge”, not(“piyo”));
• assertThat(3, between(1, 10, false));
• assertThat(“abcdefg”...
Suite and RunWith
•
•   [RunWith(“org.flexunit.runners.Suite”)]
•

•
•   public var hoge:HogeTest;
package {
  [Suite]
  [RunWith(“org.flexunit.runners.Suite”)]
  public class UtilSuite
  {
    //
        public var test1:...
•

• issueId description milestone
• [Test(issueId=#256, milestone=”ver2.30”)]
•                      (       )
Assumption
•
•              assumThat

• assumThat

•         Theory
[Test(description=”                       ”)]
public function assumeThatOKTest():void
{
  assumeThat(1, isA(1));
  Assert....
7/2/2009 18:27:25.420 [INFO] FlexUnit4 assumption::
assumeThatNGTest .
7/2/2009 18:27:25.424 [INFO] FlexUnit4 assumption::...
Theory and Datapoint
•        ?       ?

•   RunWith
    org.flexunit.experimental.theories.Theories


•   [Test]          ...
(


•   Datapoint
                1
          ?
User Interface

• ui
•
• [Before(async, ui)]
[Before(async, ui)]
public function setup():void
{
  var textInput:TextInput = new TextInput();
  Async.proceedOnEvent(
  ...
UnitTesting

•FlexUnit4
• Flexcover
• FlexMonkey
                    etc...
Flexcover
•   FlexUnit

•   GUI

•
•   JUnit     XML

•   Flex3.2     (Flex3.3   ?)

•
•   AS3



•
•
•
•

•
• Flexcover0.81
• FlexSDK3.3
    (Version 3.3.0 build 4852)
•          CoverageView.air
FlexUnit

•
• FlexSDK                   OK

•           →CoverageView
  →
• Ant
•
• Hudson
https://issues.sonatype.org/
 browse/FLEXMOJOS-18
UnitTesting

•FlexUnit4
• Flexcover
• FlexMonkey
                    etc...
• FlexAutomationAPI
•       FlexUnit FlexSpy

•                FlexMonkey1.0
→
FlexMonkey1.0
• http://opensource.adobe.com/wiki/display/
  flexunit/FlexUnit+4+feature+overview
• http://www.insideria.com/2009/05/
  fla...
•                                blog
             (

• http://prepro.wordpress.com/
Fxug@北陸in富山 - Flex Unit4Beta1+α -
Fxug@北陸in富山 - Flex Unit4Beta1+α -
Fxug@北陸in富山 - Flex Unit4Beta1+α -
Fxug@北陸in富山 - Flex Unit4Beta1+α -
Fxug@北陸in富山 - Flex Unit4Beta1+α -
Fxug@北陸in富山 - Flex Unit4Beta1+α -
Fxug@北陸in富山 - Flex Unit4Beta1+α -
Fxug@北陸in富山 - Flex Unit4Beta1+α -
Fxug@北陸in富山 - Flex Unit4Beta1+α -
Fxug@北陸in富山 - Flex Unit4Beta1+α -
Fxug@北陸in富山 - Flex Unit4Beta1+α -
Fxug@北陸in富山 - Flex Unit4Beta1+α -
Fxug@北陸in富山 - Flex Unit4Beta1+α -
Fxug@北陸in富山 - Flex Unit4Beta1+α -
Upcoming SlideShare
Loading in...5
×

Fxug@北陸in富山 - Flex Unit4Beta1+α -

2,219

Published on

FlexUnit4Beta1に関する概要
+ Flexcoverとか

Published in: Technology, Education
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,219
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Fxug@北陸in富山 - Flex Unit4Beta1+α -

  1. 1. FlexUnit4(Beta1...) +Flexcover FlexMonkey
  2. 2. • @hikaruworld • Java • Flex • Javascript Python
  3. 3. 1. FlexUnit4 2. Flexcover 3. FlexMonkey
  4. 4. UnitTesting •FlexUnit4 • Flexcover • FlexMonkey etc...
  5. 5. UnitTesting •FlexUnit4 Beta1 • Flexcover • FlexMonkey etc...
  6. 6. FlexUnit4 (Beta1) • 2009/06/29 Beta ... • JUnit4 • FlashBuilder4 ... • • GUI • FlexUnit, fluint
  7. 7. http://bugs.adobe.com/ jira/browse/FB-18873
  8. 8. http://bugs.adobe.com/ jira/browse/FB-18873
  9. 9. • libs/FlexUnit1Lib.swc • libs/FlexUnit4.swc • libs/FlexUnit4UIRunner.swc • libs/hamcrest-as3.swc
  10. 10. (GUI) • src/FlexUnit4Turnkey.mxml ( OK.) 1. FlexUnitCore 2. addListener() 3. FlexUnitCore .run() (GUI UIListener new ) 4. run()
  11. 11. import flash.display.Sprite; import org.flexunit.runner.FlexUnitCore; public class FlexUnit4CUI extends Sprite { public function FlexUnit4CUI() { var core:FlexUnitCore = new FlexUnitCore(); core.run( ); } }
  12. 12. JUnit4→FlexUnit4 • @Test • [Test] • @Before • [Before] • @BeforeClass • [BeforeClass] • @After • [After] • @AfterClass • [AfterClass] • @Ignore • [Ignore]
  13. 13. flexunit.framework.*
  14. 14. org.flexunit.*
  15. 15. package { import org.flexunit.Assert; public class CalculateTest { private var target:Calculate { [Test] public function ():void { target = new Calculate(); Assert.assertEquals(2, target.add(1, 1)) } } } }
  16. 16. Before and After • [Test] / • [async] [ui] • Before/After [Before(order=1)]
  17. 17. BeforeClass/AfterClass • / • static
  18. 18. Before/After →
  19. 19. Exception Handling • [Test(expected=” ”)] • expected throw Error ex)flash.errors.IllegalOperationError
  20. 20. [Test(expected=”flash.errors.IllegalOperationError”)] public function exceptionTest():void { throw new IllegalOperationError(“error...”); }
  21. 21. Ignore • [Ignore] • [Test] • • [Ignore(“ ”)]
  22. 22. [Ignore(“ ”)] [Test] public function ignoreTest():void { // }
  23. 23. Ignore • org.flexunit.flexui.TestRunnerBase.mxml Ignore ? • I •
  24. 24. 7/2/2009 17:08:19.629 [INFO] FlexUnit4 ignore::IgnoreTest. . ← 7/2/2009 17:08:19.632 [INFO] FlexUnit4 ignore::IgnoreTest. I ←
  25. 25. Async • Async fluint • Before/After/Test • timeout=” ” • [Test(async, timeout=”500”)] • Async.asyncHandler
  26. 26. [Test(async, timeout=”500”)] public function ():void { var timer:Timer = new Timer(300, 1); timer.addEventListener(TimerEvent.TIME_COMPLETE, Async.asyncHandler(this, onResult, 300)); timer.start(); } private function onResult( e:TimerEvent, passThrowsData:Object):void{ Assert.assertEquals(e.type, “timeComplete”); }
  27. 27. Hamcrest • • Hamcrest AS3 • • assertThat( , ( ))
  28. 28. http://github.com/drewbourne/ hamcrest-as3/tree/master
  29. 29. • Hamcrest-AS3 ? • ASDoc • • Java PHP • org.hamcrest.number org.hamcrest.text org.hamcrest.object....
  30. 30. • assertThat(3, isA(3)); • assertThat(“hoge”, not(“piyo”)); • assertThat(3, between(1, 10, false)); • assertThat(“abcdefg”, allOf( startsWith(“a”), endsWith(“g”))); • etc.....
  31. 31. Suite and RunWith • • [RunWith(“org.flexunit.runners.Suite”)] • • • public var hoge:HogeTest;
  32. 32. package { [Suite] [RunWith(“org.flexunit.runners.Suite”)] public class UtilSuite { // public var test1:HogeTest; public var test2:PiyoTest; } }
  33. 33. • • issueId description milestone • [Test(issueId=#256, milestone=”ver2.30”)] • ( )
  34. 34. Assumption • • assumThat • assumThat • Theory
  35. 35. [Test(description=” ”)] public function assumeThatOKTest():void { assumeThat(1, isA(1)); Assert.fail(“ ”); } [Test(description=” ”)] public function assumeThatNGTest():void { assumeThat(1, isA(3)); Assert.fail(“ ”); }
  36. 36. 7/2/2009 18:27:25.420 [INFO] FlexUnit4 assumption:: assumeThatNGTest . 7/2/2009 18:27:25.424 [INFO] FlexUnit4 assumption::NG I 7/2/2009 18:27:25.429 [INFO] FlexUnit4 assumption:: assumeThatOKTest . 7/2/2009 18:27:25.449 [WARN] FlexUnit4 assumption:: assumeThatOKTest E
  37. 37. Theory and Datapoint • ? ? • RunWith org.flexunit.experimental.theories.Theories • [Test] [Theory] • [Datapoint]
  38. 38. ( • Datapoint 1 ?
  39. 39. User Interface • ui • • [Before(async, ui)]
  40. 40. [Before(async, ui)] public function setup():void { var textInput:TextInput = new TextInput(); Async.proceedOnEvent( this, textInput, FlexEvent.CREATION_COMPLETE, 200); UIImpersonator.addChild( panel ); }
  41. 41. UnitTesting •FlexUnit4 • Flexcover • FlexMonkey etc...
  42. 42. Flexcover • FlexUnit • GUI • • JUnit XML • Flex3.2 (Flex3.3 ?) •
  43. 43. • AS3 • • • • •
  44. 44. • Flexcover0.81 • FlexSDK3.3 (Version 3.3.0 build 4852) • CoverageView.air
  45. 45. FlexUnit • • FlexSDK OK • →CoverageView →
  46. 46. • Ant • • Hudson
  47. 47. https://issues.sonatype.org/ browse/FLEXMOJOS-18
  48. 48. UnitTesting •FlexUnit4 • Flexcover • FlexMonkey etc...
  49. 49. • FlexAutomationAPI • FlexUnit FlexSpy • FlexMonkey1.0
  50. 50.
  51. 51. FlexMonkey1.0
  52. 52. • http://opensource.adobe.com/wiki/display/ flexunit/FlexUnit+4+feature+overview • http://www.insideria.com/2009/05/ flashbuilder4-will-support-fle.html • http://github.com/drewbourne/hamcrest- as3/tree/master
  53. 53. • blog ( • http://prepro.wordpress.com/

×