Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Spock 0.6

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains how to use Spock 0.6. the content of the explanation in the article is simple and clear, and it is easy to learn and understand. please follow the editor's train of thought to study and learn how to use Spock 0.6. let's go deep together.

Spock 0.6 has been released, and Spock 0.6 has added support for Groovy 1.8, Groovy 2.0, and and Grails 2.0. For a detailed record of improvements, please see here.

Spock is a testing framework for Java and Groovy applications. Sample code:

Import groovy.sql.Sql import spock.lang.* class DatabaseDriven extends Specification {@ Shared sql = Sql.newInstance ("jdbc:h3:mem:", "org.h3.Driver") / / normally an external database would be used, / / and the test data wouldn't have to be inserted here def setupSpec () {sql.execute ("create table maxdata (id int primary key, an int, b int, c int)") sql.execute ("insert into maxdata values (1,3,7)" 7), (2, 5, 4, 5), (3, 9, 9, 9))} def "maximum of two numbers" () {expect: Math.max (a, b) = c where: [a, b, c]

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report