Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use Spock 0.6

Shulou Source: shulou.com Published: 2022-06-02 04:03:34 11月16日 Update

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]

Tags: Learning content code that is applications ideas situations articles more frameworks knowledge knowledge points examples programs articles please see follow questions practice application Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information macOS Shulou Tech Info Apple NVidia