huangapple go评论73阅读模式

Is Maven Multi-Module project a good solution for automated tests (Selenium, Appium, Karate)?


我最近创建了一个使用Selenium来编写Web自动化测试的Java Maven项目。






I have recently created a Java Maven project using Selenium to script web automated tests.

Now I have to script mobile automated tests, to do so I am going to use Appium.

Instead of creating another project quite similar, I wanted to convert my Maven project to a Maven Multi-Module in which a module will contain web automated tests, an other one will contain mobile automated tests and the last one will contain common logics (later another module will be used for API automated tests using Karate).

I want to know if it is a good idea to use a Maven Multi-Module to do it and if it is, I also want to know if sharing classes in the same project through modules is a good practice.

Thanks a lot for helping.


得分: 0

是的!多模块项目是将项目拆分为逻辑组件的绝佳方式。但我会考虑一些事情。首先,你的测试是 Junit 还是 TestNG 测试?如果是的话,我可能会将它们留在主项目的 src/test 目录下。

从你的描述听起来,这些测试似乎不完全是“单元”测试,但你仍然可以将它们分开并分组。(TestNG 有分组功能,我相信 JUnit 也有类似的功能)当我有一个同时包含“单元”测试和“集成”测试的项目时,我会让单元测试在正常的构建过程中运行,并使用 Maven 配置文件来运行集成测试。但如果这听起来太麻烦的话,是的,我认为多模块是一个不错的选择。



Yes! Multi-module projects are a great way to split up your project into logical components. But I would consider a few things. First, are your tests Junit or TestNG tests? If they are, I would probably just leave them in your main project under the src/test directory.

From the sound of it, it doesn't seem like these tests are 'unit' tests exactly, but you can still separate and group them. (TestNG has groups and I believe JUnit has something similar) When I have a project with 'unit' and 'integration' tests, I will make unit tests run during the normal build process. And make integration tests run using a maven profile. But if that sounds like too much work, yes, I think multi-modules is a fine way to go.

And yes, sharing classes between modules is definitely good practice. Just as long as you don't have any circular dependencies. That's really the only rule.

  • 本文由 发表于 2020年7月22日 04:57:11
  • 转载请务必保留本文链接:



:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: