国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 網(wǎng)站 > WEB開(kāi)發(fā) > 正文

24.10.生成自動(dòng)測(cè)試集

2024-04-27 13:52:37
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
24.10.1. 問(wèn)題
我想自動(dòng)生成包含所有測(cè)試用例的測(cè)試集。
24.10.2. 解決辦法
使用Antennae TestSuite-generation工具。
24.10.3. 討論
TestCase必須包含進(jìn)TestSuite才可以運(yùn)行。創(chuàng)建新的TestCase并添加到TestSuite已經(jīng)成為一種體力活。為了代替這種手工添加每個(gè)TestCase到TestSuite,你可以讓TestSuite自動(dòng)生成。開(kāi)源的Antennae項(xiàng)目包含一個(gè)工具自動(dòng)檢測(cè)源代碼目錄和包含的測(cè)試自動(dòng)生成TestSuite。

Antennae 包中的lib 子目錄包含一個(gè)JAR 文件叫arc-flexunit2.jar , 里面有個(gè)類叫com.allurent.flexunit2.framework.AllTestsFileGenerator。當(dāng)AllTestsFileGenerator在源代碼目錄運(yùn)行時(shí),它會(huì)尋找所有命名為Test*.as 或*Test.as并創(chuàng)建包含它們的TestSuite。這個(gè)工具在可以被重新定位的標(biāo)準(zhǔn)輸出上創(chuàng)建TestSuite。生成的TestSuite文件被叫做FlexUnitAllTests。

假設(shè)Antennae被解壓到~/Antennae和C:/Antennae,你可以像下面那樣調(diào)用此工具:
java -cp ~/Antennae/lib/arc-flexunit2.jar
com.allurent.flexunit2.framework.AllTestsFileGenerator
~/FlexCookbook/src/ > ~/FlexCookbook/src/FlexUnitAllTests.as

java -cp C:/Antennae/lib/arc-flexunit2.jar
com.allurent.flexunit2.framework.AllTestsFileGenerator
C:/FlexCookbook/src/ > C:/FlexCookbook/src/FlexUnitAllTests.as
第一個(gè)例子中, ~/Antennae/lib/arc-flexunit2.jar 是JAR 文件的位置。運(yùn)行的類名為com.allurent.flexunit2.framework.AllTestsFileGenerator,~/FlexCookbook/src/是源代碼目錄位置,~/FlexCookbook/src/FlexUnitAllTests.as 是生成文件的位置。

生成的TestSuite文件大概是這樣:
+展開(kāi)
-ActionScript
package
{
import flexunit.framework.*;
import mx.containers.CanvasTest;
import mx.containers.TileTest;
public class FlexUnitAllTests
{
public static function suite() : TestSuite
{
var testSuite:TestSuite = new TestSuite();
testSuite.addTestSuite(mx.containers.CanvasTest);
testSuite.addTestSuite(mx.containers.TileTest);
return testSuite;
}
}
}

當(dāng)FlexUnit應(yīng)用程序被編譯之前,總是需要自動(dòng)生成FlexUnitAllTests文件(請(qǐng)看Antennae文檔關(guān)于Flex Builder下使用AllTestsFileGenerator工具的更多細(xì)節(jié))

為了代替在主應(yīng)用程序中手動(dòng)構(gòu)建TestSuite,可直接用FlexUnitAllTests類來(lái)代替TestSuite運(yùn)行。每次FlexUnitAllTests類被重新生成時(shí),所有包含的測(cè)試都將被重新編譯和運(yùn)行。使用FlexUnitAllTests的FlexUnit應(yīng)用程序如下:
+展開(kāi)
-XML
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:flexui="flexunit.flexui.*"
creationComplete="handleCreationComplete();">

<mx:Script>
<![CDATA[
import flexunit.framework.TestSuite;
private function handleCreationComplete():void
{
testRunner.test = FlexUnitAllTests.suite();
testRunner.startTest();
}

]]>
</mx:Script>
<flexui:TestRunnerBase id="testRunnerwidth="100%height="100%"/>
</mx:Application>
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 锡林郭勒盟| 攀枝花市| 德兴市| 左贡县| 凤台县| 建瓯市| 麻栗坡县| 渑池县| 盱眙县| 巴林右旗| 岑溪市| 门源| 尚义县| 新田县| 武乡县| 沁源县| 来宾市| 柳林县| 沙湾县| 鄂州市| 定襄县| 大丰市| 德庆县| 独山县| 鄂尔多斯市| 广汉市| 新宁县| 偃师市| 淳化县| 沾益县| 桃江县| 延边| 廊坊市| 视频| 阿图什市| 武陟县| 班戈县| 稷山县| 通榆县| 云阳县| 金昌市|