• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

十分钟入门 Tellurium (英文版)

发布: 2009-6-16 13:08 | 作者: 网络转载 | 来源: 领测软件测试网采编 | 查看: 79次 | 进入软件测试论坛讨论

领测软件测试网

Create Your own UI modules and Test Cases

Tellurium provides TrUMP for you to automatically create UI modules. TrUMP can be download from Tellurium project site

http://code.google.com/p/aost/downloads/list

Choose the Firefox 2 or Firefox 3 version depending on your Firefox version. Or you can download the Firefox 3 version directly from Firefox addons site at

https://addons.mozilla.org/en-US/firefox/addon/11035

Once you install it and restart Firefox, you are ready to record your UI modules by simply clicking on the UI element on the web and then click the "generate" button. You may like to customize your UI a bit by clicking the "Customize" button. More detailed TrUMP introductions can be found at

http://code.google.com/p/aost/wiki/TrUMP

and

http://code.google.com/p/aost/wiki/HowTrUMPWorks

In our example, we open up Tellurium download page

http://code.google.com/p/aost/downloads/list

and record the download search module as follows

LRuVAwbLjuTZtSqonpmmrv0I-p7nCVZQmP65Tb_vjspK02CR95VRrtmeQ&gsc=r5ESUAsAAAB_6XgBAY-OTO2KhvY2ZJUe">

After we customize the UI module, we export it as the module file NewUiModule.groovy to the demo project and add couple methods to the class.

class NewUiModule extends DslContext {

 
public void defineUi() {
    ui
.Form(uid: "TelluriumDownload", clocator: [tag: "form", method: "get", action: "list"], group: "true") {
     
Selector(uid: "DownloadType", clocator: [tag: "select", name: "can", id: "can"])
     
InputBox(uid: "Input", clocator: [tag: "input", type: "text", name: "q", id: "q"])
     
SubmitButton(uid: "Search", clocator: [tag: "input", type: "submit", value: "Search"])
   
}
 
}

 
//Add your methods here
 
public void searchDownload(String keyword) {
    keyType
"TelluriumDownload.Input", keyword
    click
"TelluriumDownload.Search"
    waitForPageToLoad
30000
 
}

 
public String[] getAllDownloadTypes() {
   
return getSelectOptions("TelluriumDownload.DownloadType")
 
}

 
public void selectDownloadType(String type) {
    selectByLabel
"TelluriumDownload.DownloadType", type
 
}
}

Then, create a new Tellurium test case NewTestCase by extending TelluriumJavaTestCase class.

public class NewTestCase extends TelluriumJavaTestCase {
   
private static NewUiModule app;

   
@BeforeClass
   
public static void initUi() {
        app
= new NewUiModule();
        app
.defineUi();
   
}

   
@Before
   
public void setUpForTest() {
        connectUrl
("http://code.google.com/p/aost/downloads/list");
   
}

   
@Test
   
public void testTelluriumProjectPage() {
       
String[] allTypes = app.getAllDownloadTypes();
        assertNotNull
(allTypes);
        assertTrue
(allTypes[1].contains("All Downloads"));
        app
.selectDownloadType(allTypes[1]);
        app
.searchDownload("TrUMP");
   
}
}

Compile the project and run the new test case.

Tellurium TestNG Project

If you want to create a new Tellurium TestNG project, simply use a different Maven archetype as follows,

mvn archetype:create -DgroupId=example -DartifactId=demo -DarchetypeArtifactId=tellurium-testng-archetype -DarchetypeGroupId=tellurium -DarchetypeVersion=1.0-SNAPSHOT

and the new Tellurium test case should extend TelluriumTestNGTestCase class. The rest are the same as the JUnit ones.

Resources

The slides for this tutorial is available at

http://aost.googlecode.com/files/Ten.Minutes.To.Tellurium.pdf

The Screencast video is available at

http://aost.googlecode.com/files/TenMinutesToTellurium.ogg

Here is the online version

The generated Demo project can be downloaded from here or check it out from Subversion

http://aost.googlecode.com/svn/branches/ten-minutes-to-tellurium/

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/

22/2<12

关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网