简体   繁体   English

连续测试的代码结构

[英]Code structure for continuous testing

I am building a CD pipeline. 我正在建立CD管道。 I am planning about the automated testing piece of it. 我正在计划进行自动化测试。 I plan to do UI, WebService, Security, Perf testing. 我计划进行UI,WebService,安全性,Perf测试。 I have a question about the code structure. 我对代码结构有疑问。 So what I plan is to have the tests in the same repo as the code and then have separate repos for the core test frameworks eg 因此,我计划将测试与代码存储在同一存储库中,然后为核心测试框架提供单独的存储库,例如

Repo Product 回购产品

  • Product Code (Project) 产品代码(项目)
  • Integration Tests (Project) 集成测试(项目)
  • Functional/e2e Tests (Project) 功能/端到端测试(项目)
    • UI Tests (Package) UI测试(打包)
    • WebSvc Tests (Package) WebSvc测试(软件包)
    • Perf Tests (Package) 性能测试(包装)
    • Sec.Tests (Package) 二次测试(包装)

Repo Test Core 回购测试核心

  • UI Test Framework Code (Project) UI测试框架代码(项目)
  • WebSvc Test Framework Code (Project) WebSvc测试框架代码(项目)
  • Perf Test Framework Code (Project) 性能测试框架代码(项目)
  • Sec Test Framework Code (Project) 秒测试框架代码(项目)

Does anyone see any problem with this structure? 有人看到这个结构有问题吗? Any other ideas? 还有其他想法吗? Also I am little fuzzy about the what goes in the integration tests vs in the functional tests projects (eg WebSvc tests can be a part of both). 另外,对于集成测试和功能测试项目的进展情况,我也不太模糊(例如,WebSvc测试可以是两者的一部分)。 And where does acceptance tests go (Functional or integration) ? 验收测试在哪里进行(功能或集成)? It will be great if someone can point to some example repos or articles on this. 如果有人可以指向一些示例存储库或文章,这将是很棒的。

Thanks 谢谢

I find this structure somewhat irritating. 我发现这种结构有些恼人。

From the proposed structure I deduct that you want to build your own test frameworks. 从建议的结构中,我推断出您想构建自己的测试框架。 That sounds fishy to me especially when you want to write 4 of them. 对我来说,这听起来很可疑,尤其是当您要编写其中的4个时。

On the other hand you put them all in the same repository, so they seem to be closely related. 另一方面,您将它们全部放在同一存储库中,因此它们似乎密切相关。 Again: not necessarily bad/wrong, but really unexpected. 再说一次:不一定是坏/错,但真的出乎意料。

Since apart from the structure I can't find a hint in your question, that gives a good reason to have separate repositories, so I would recommend to use just one, assuming your "testframeworks" are just utilities to test your main project. 由于除了结构之外,我在您的问题中找不到任何提示,这为拥有单独的存储库提供了充分的理由,因此,我建议仅使用一个存储库,假设您的“ testframeworks”只是用于测试主项目的实用程序。

The basic rule is things that change together should go together (in one repository). 基本规则是,一起改变的事物应该一起(在一个存储库中)。 Everything else makes development really cumbersome: change A, install, change B, run, debug, repeat instead of change, run, debug, repeat 其他所有事情都使开发变得非常麻烦:更改A,安装,更改B,运行,调试,重复,而不是更改,运行,调试,重复

Since you mentioned you are not completely clear, what will go where, I recommend the following: 既然您提到您还不十分清楚,那该怎么办,我建议以下几点:

Start with a single project. 从一个项目开始。 Write ALL tests in the test directory of that project. 将所有测试写入该项目的测试目录中。 Observe if you experience problems. 观察是否遇到问题。 If so adapt. 如果是这样,请适应。 Things you might experience, that trigger extraction of projects: 您可能会遇到的触发项目提取的事情:

  • Tests run slow and you want to run them separately 测试运行缓慢,您想单独运行它们
  • Tests need a deployed application, so they should run after building and installing everything else 测试需要已部署的应用程序,因此它们应在构建和安装其他所有内容后运行
  • Tests in different modules need access to code that should not live in the main projects so it might end up in a module with test supporting code 不同模块中的测试需要访问不应存在于主项目中的代码,因此它可能最终包含测试支持代码的模块中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM