`

play framework学习笔记之测试test

阅读更多

play test hy3 测试运行模式命令

http://localhost:9000/@tests访问地址

在测试包下创建测试类,测试方法上加@Test的annotation

play的测试分三种

//功能性测试

public class ApplicationTest extends FunctionalTest {

@Test

public void testThatIndexPageWorks() {

Response response = GET("/");

assertIsOk(response);

assertContentType("text/html", response);

assertCharset("utf-8", response);

}

}

//普通的单元测试

public class BasicTest extends UnitTest {

@Test

public void aVeryImportantThingToTest() {

assertEquals(2, 1 + 1);

}

}

//selenium测试 是以html文件的形式

Application.test.html

*{ You can use plain selenium command using the selenium tag }*

#{selenium}

// Open the home page, and check that no error occured

open('/')

assertNotTitle('Application error')

#{/selenium}

以上的三种测试都会在test模式下http://localhost:9000/@tests窗口中被区分并被测试.划分的很详细,有专门的测试页面的方法

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics