specs2

    1热度

    2回答

    遇到麻烦与的Mockito嘲笑从返回任一种Object或Exception的方法的响应。嘲笑的方法的签名是这样的: def findResult(request: String): Future[Seq[String] Or MyException] = ,并在我的功能我想只返回一个成功的Future: when(client.findResult("1234")) thenReturn Futu

    0热度

    1回答

    我有一组规格,它们有重复的代码。我一直使用不同的输入调用相同的方法,并对结果进行相同的一组断言。 我想使用一个函数来减少重复,有点像下面的例子。有没有办法做到这一点?如果是这样,是否有办法做到这一点,以便我的断言可以在整个函数体中混合,并且函数返回类型不必是匹配器? "MyApp" should { "do something" in { tryOperation("larg

    0热度

    1回答

    之后,从规格升级后2.4.13到3.7.1 "foo" should { "bar" >> prop((i: Int) => i % 50 must be>= 0 ) } 不再编译。它失败 type mismatch; [error] found : org.specs2.specification.core.Fragment [error] required: o

    0热度

    2回答

    我试图使用GWT规格完全支持,但其official documentation的示例有点简单。 在搜索SO,我发现这样一个问题: Specs2 - How to define complex objects for Given/When/Then steps 但它太旧(3年),我认为在specs2做GWT的方式发生了变化。 到目前为止,我有这个简单的测试: class FlowCollectorS

    2热度

    1回答

    我使用specs2,我的理解是must和should是等效的(请参阅What is the difference between should and must in scala testing?),使用其中一个或另一个只是个人偏好。 但是,使用must作品比较字符串,下面的测试时: import org.specs2.mutable._ class StringEqualWithMust e

    1热度

    1回答

    对于一个项目,我将一些测试迁移到ScalaTest而不是Specs2。是否有可能在同一个项目中运行基于SBT框架的测试?

    0热度

    1回答

    我在为自己的线程运行的Play应用程序中编写混音测试时遇到了麻烦。我已经尝试了覆写WithApplication.provideApplication方法,但没有运气。我收到一个inheriting conflicting methods错误。 (一个来自真实应用程序“MyRunnableSystemWrapper”,一个来自我的嘲笑假mixin叫“MyMockedSystemWrapper”)。

    0热度

    1回答

    使用SBT测试代码 package examples import org.specs2._ class ScalaCheckExamplesSpec extends Specification with ScalaCheck { def is = s2""" startsWith ${ prop { (a: String, b: String) => (a+b) must sta

    0热度

    1回答

    我使用playframework 2.2.6 scala。 我想为我的应用程序编写集成测试。但我的应用程序通过http请求一些服务,我想用mockServer来模拟它。但我不知道什么时候开始和停止mockServer原因试验利用期货 @RunWith(classOf[JUnitRunner]) class AppTest extends Specification with Around {

    0热度

    1回答

    如果我的戏应用程序是这样的: class Foo() extends Bar {} class Application @Inject (f: Foo) extends Controller { def index = Action { OK("Hi, Foo App") } } 我如何改变我的规格测试接受MockedFoo类? @RunWith(classOf[JUnitRu