Groovy for Java集成测试的更好选择? [英] Any better alternative to Groovy for Java integration testing?

查看:212
本文介绍了Groovy for Java集成测试的更好选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划使用其编程接口来测试基于Java的Web应用程序。为此,我打算使用它们的RMI / WebService接口调用会话bean,并检查它们支持的服务是否正确。要做到这一点,我需要一种脚本语言:


  • 调用我的RMI / WebService接口

  • 执行SQL语句(例如,首先清理数据库)

  • 简单的流量控制(循环,条件等)

  • 理解。我可能会要求我的非程序员员工编写测试脚本。我计划使用Groovy来实现此目标。 有没有更好的建议或替代Groovy?



    编辑1



    其他介绍了Groovy在JRuby和RSpec中提到的替代方案。有没有在网上比较他们?

    解决方案

    我认为Groovy是您可以用于测试的最佳选择。与Java的Groovy集成是无缝的,因此调用方法,库和类似的东西通常可以顺利运行。另外,开始使用Groovy的公司通常会开始使用它进行测试,然后在生产代码中使用它。



    正如@tim_yates所说, Spock 是一个用于测试的Groovy框架,也是一个很好的框架。您也可以毫无问题地使用 JUnit / EasyMock / TestNG / Whatever ,而Groovy本身也带有< GroovyTestCase (基于JUnit)完成工作。

    Groovy还可以让你编写很酷的DSLs ,它可以帮助您为非程序员实现一种编程语言,就像您说的那样。

    SQL Groovy支持也很简单。您可以使用 groovy.sql 软件包类,并开始使用它,或者如果你愿意,你可以去JPA。


    I am planning to test my Java-based web application using its programming interfaces. To this aim, I intend to call my session beans using their RMI/WebService interfaces and check if their supported services are correct or not. To do this, I need a scripting language to:

    • Call my RMI/WebService interfaces
    • Execute SQL statements (e.g. for cleaning the DB at first)
    • Have a simple flow control (loops, conditions, etc. )
    • Be easy to understand. I may ask my non-programmer staff to write test scripts

    I am planning to use Groovy to this aim. Is there any better suggestion or alternative for Groovy?

    Edit 1

    Other introduced alternatives to Groovy mentioned in answers are JRuby and RSpec. Is there any comparison for them on the web?

    解决方案

    I think Groovy is the best that you can use for your tests. Groovy integration with Java is seamless, thus calling methods, libraries, and stuff like that usually run smooth.

    Also companies which are starting to use Groovy usually start using it for tests, and later use it in production code.

    As @tim_yates said, Spock is a Groovy framework for testing and a great one. You can also use JUnit/EasyMock/TestNG/Whatever without problems, and Groovy itself comes with the GroovyTestCase (based on JUnit) which gets the job done.

    Groovy also enables you to write cool DSLs, which help you to achieve a programming language for non-programmers, as you said you need.

    SQL support in Groovy is also simple. You can use groovy.sql package classes and get started really fast with it, or you can go for JPA if you want.

    这篇关于Groovy for Java集成测试的更好选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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