RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
Spock0.6发布Java测试框架

Spock 0.6 发布,Spock 0.6 增加对 Groovy 1.8, Groovy 2.0, and Grails 2.0 的支持,详细的改进记录请看这里。

Spock 是适合 Java 和 Groovy 应用程序的一个测试框架。示例代码:

 
 
 
  1. import groovy.sql.Sql  
  2.  
  3. import spock.lang.*  
  4.  
  5. class DatabaseDriven extends Specification {  
  6.   @Shared sql = Sql.newInstance("jdbc:h2:mem:", "org.h2.Driver")  
  7.    
  8.   // normally an external database would be used,  
  9.   // and the test data wouldn't have to be inserted here  
  10.   def setupSpec() {  
  11.     sql.execute("create table maxdata (id int primary key, a int, b int, c int)")  
  12.     sql.execute("insert into maxdata values (1, 3, 7, 7), (2, 5, 4, 5), (3, 9, 9, 9)")  
  13.   }  
  14.  
  15.   def "maximum of two numbers"() {  
  16.     expect:  
  17.     Math.max(a, b) == c  
  18.  
  19.     where:  
  20.     [a, b, c] << sql.rows("select a, b, c from maxdata")  
  21.   }  

下载地址:http://code.google.com/p/spock/downloads/list


分享名称:Spock0.6发布Java测试框架
本文地址:http://www.jxjierui.cn/article/cdoooji.html