将Play项目拆分为子模块时,我在哪里进行测试

时间:2015-11-23 13:20:44

标签: scala unit-testing playframework

软件堆栈:

  • 播放:addSbtPlugin(" com.typesafe.play"%" sbt-plugin"%" 2.4.3")
  • 测试框架:" org.scalatestplus" %%"播放" %" 1.4.0-M3" % 测试
  • Scala:scalaVersion:=" 2.11.7"
  • Java:1.8.0.40-b26
  • SBT: sbt.version = 0.13.8

我有一个单片Play应用程序,我正在分成子模块。我有许多单元和集成测试,它们当前位于项目根目录的/ test文件夹中。

我将它分成两个主要模块' audit'和'用户'。目录结构目前是这样的

/
/conf  -- application.conf & routes which references the child module route files 
/module
/module/user
/module/user/app   -- here I have UserController and some model code
/module/user/conf  -- here I have user.Routes
/module/audit
/module/audit/app  -- here I have AuditController and some model code
/module/audit/conf -- here I have audit.Routes
/test

测试(单元测试和硒集成测试的混合)目前正在测试中。我想将单元测试移到他们的模块中。我已经尝试了“显而易见的”审计,我将它们放在/ module / audit / test和/ module / audit / src / test / scala中。在SBT,我尝试过检查scalaSource'它告诉我审计模块的测试目录是......序言... / module / audit / test

不幸的是,当我尝试'测试'在SBT中,子模块中的测试没有被提取。我已尝试将以下内容添加到审核模块

测试中的

scalaSource:= baseDirectory.value /" src" /"测试" /" scala"

不被接走'我的意思是'文件中的编译错误没有被检测到'并且'测试未执行'。换句话说,测试中的" scalaSource"密钥似乎没有被使用

Play框架项目的推荐方法是什么?

0 个答案:

没有答案