Mais conteúdo relacionado Semelhante a Fxug@北陸in富山 - Flex Unit4Beta1+α - (20) Fxug@北陸in富山 - Flex Unit4Beta1+α -6. FlexUnit4 (Beta1)
• 2009/06/29 Beta ...
• JUnit4
• FlashBuilder4 ...
•
• GUI
• FlexUnit, fluint
16. JUnit4→FlexUnit4
• @Test • [Test]
• @Before • [Before]
• @BeforeClass • [BeforeClass]
• @After • [After]
• @AfterClass • [AfterClass]
• @Ignore • [Ignore]
21. 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))
}
}
}
}
28. [Ignore(“ ”)]
[Test]
public function ignoreTest():void
{
//
}
29. Ignore
• org.flexunit.flexui.TestRunnerBase.mxml
Ignore ?
•
I
•
31. Async
• Async fluint
• Before/After/Test
• timeout=” ”
• [Test(async, timeout=”500”)]
• Async.asyncHandler
32. [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”);
}
36. • Hamcrest-AS3 ?
• ASDoc
•
• Java PHP
• org.hamcrest.number
org.hamcrest.text
org.hamcrest.object....
37. • assertThat(3, isA(3));
• assertThat(“hoge”, not(“piyo”));
• assertThat(3, between(1, 10, false));
• assertThat(“abcdefg”, allOf(
startsWith(“a”), endsWith(“g”)));
• etc.....
39. package {
[Suite]
[RunWith(“org.flexunit.runners.Suite”)]
public class UtilSuite
{
//
public var test1:HogeTest;
public var test2:PiyoTest;
}
}
42. [Test(description=” ”)]
public function assumeThatOKTest():void
{
assumeThat(1, isA(1));
Assert.fail(“ ”);
}
[Test(description=” ”)]
public function assumeThatNGTest():void
{
assumeThat(1, isA(3));
Assert.fail(“ ”);
}
43. 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
44. Theory and Datapoint
• ? ?
• RunWith
org.flexunit.experimental.theories.Theories
• [Test] [Theory]
• [Datapoint]
47. [Before(async, ui)]
public function setup():void
{
var textInput:TextInput = new TextInput();
Async.proceedOnEvent(
this, textInput, FlexEvent.CREATION_COMPLETE, 200);
UIImpersonator.addChild( panel );
}
49. Flexcover
• FlexUnit
• GUI
•
• JUnit XML
• Flex3.2 (Flex3.3 ?)
•
67. • blog
(
• http://prepro.wordpress.com/