空手道vs斯波克 [英] Karate vs Spock

查看:140
本文介绍了空手道vs斯波克的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近找到了用于测试Web服务的空手道框架.但是,还有 Spock 框架提供了类似的功能(在我看来是 ).框架之间有什么区别?我想建议我们的测试人员来看看它.

I've recently found Karate framework for testing Web Services. But there is also Spock framework providing similar (to my mind) functionality. What are the differences between the frameworks? I would like to suggest our testers to take a look at it.

推荐答案

此处是空手道的开发人员.我只读过Spock,但这是我的PoV.

Developer of Karate here. I have only read about Spock but here's my PoV.

空手道专注于测试HTTP Web服务,因此旨在对JSON和XML进行操作和执行断言.结果-您不再需要POJO- .

Karate is laser-focused on testing HTTP web-services, and therefore is designed to manipulate and perform assertions on JSON and XML. As a result - you do not need POJO-s any-more.

而Spock是通用测试框架.它基于Groovy,因此与仅使用Java相比,它会降低冗长程度,并且添加了BDD风格,在表示测试用例时很有价值.就像Karate一样,它具有测试用例的结构,生命周期(在进行挂钩,环境切换等之前),数据驱动的测试助手,以及与单元测试和报告框架(例如JUnit)的集成.

Whereas Spock is a general-purpose testing framework. It is based on Groovy, so it reduces the verbosity somewhat compared to if you just used Java, and it adds the BDD flavor that is of value in expressing test-cases. Just like Karate, it has a structure to test-cases, a life-cycle (before hooks, environment switching, etc.) data-driven test helpers, and integration with unit-test and reporting frameworks such as JUnit.

IMO的一个主要区别是,尽管Spock和类似的框架试图抽象化Java的冗长性,以支持更清晰易读的语法-它们仅在一定程度上取得了成功.空手道几乎完全绕开了Java(来自测试作者PoV),这意味着您正在所需的确切层"中进行操作-即HTTP和JSON/XML.

A key difference IMO is that while Spock and similar frameworks try to abstract away the verbosity of Java in favor of a cleaner more readable syntax - they succeed only to a certain extent. Karate almost bypasses Java completely (from a test writers PoV) which means that you are operating in the exact 'layer' that you want to - which is HTTP and JSON / XML.

我想向您指出空手道和REST保证之间的比较-因为某些观点也适用于Spock,这对于评估空手道的任何团队都是有用的参考.

I'd like to point you to this comparison between Karate and REST-assured - since some of the points would apply to Spock as well, and it would be a helpful reference for any team evaluating Karate.

这篇关于空手道vs斯波克的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆