Java Reference
In-Depth Information
Running Arquillian tests using Spock
Arquillian is not limited to only JUnit. As we mentioned earlier, there are already contain-
ers, for example, TestNG and Spock; let's focus on the second one.
Spock is a modern testing framework written in Groovy and uses some of the Groovy lan-
guage features to make your tests more readable and easier to write. Spock's primary goal
is to test the Groovy code but it is perfect to write all kinds of tests for the Java code. Spock
introduces a few additional semantics with its Domain Specific Language ( DSL ) in order
to make testing even more easier and developer friendly.
Let's rewrite our previous test example using Spock:
class TicketServiceTest extends Specification {
def static WebArchive createTestArchive() {
return ShrinkWrap.create(WebArchive.class)
TicketService ticketService;
def "should create SeatType"() {
def seatType = new SeatType(description: "Balcony",
price: 11, quantity: 6)
Search WWH ::

Custom Search