测试自动化套件将如何在使用Maven或测试时在CI/CD工具上运行?

huangapple go评论51阅读模式
英文:

How test automation suite will run on CI/CD tools while running using maven or testing?

问题

这可能是一个愚蠢的问题,但我对这个CI/CD工具自动化非常陌生。让我告诉您我需要什么,我们已经为API测试构建了一个框架。在这里,我们使用rest-assured、spring框架<spring配置文件,Spring配置,..>、allure报告、testng设计:我们在src/tests/java/testone.java下编写了测试用例,并在src/main/resources下配置了配置、数据和报告配置。现在我的问题是,在CI/CD工具(如bamboo/jenkins)上使用maven命令运行测试时,这个框架会在自己的服务器上运行,还是会使用bamboo/jenkins服务器?因为我知道CI/CD工具只是代理。这些框架究竟是如何在CI/CD工具上运行的?它会在构建后运行,比如创建jar文件,然后在服务器上运行吗?通常,测试自动化套件不会创建任何jar文件/某些文件...它们只会像应用程序一样运行。请让我更多了解一下。

英文:

It might be stupidity question but I am very new to this CI/CD tools automaiton. Let me tell what I need , we have built a framework for API testing. here we are using rest-assured, spring framework <spring profile , sprint configuration,..>, allure report, testng Design: we have written test cases under src/tests/java/testone.java and configuration, data, report config under src/main/resources now my question is while running tests using maven command on CI/CD tools like bamboo/jenkins ..will this framework runs on its own server or will it use bamboo/jenkins server ? as I know CI/CD tools are just agents. exactly how these frameworks run on CI/CD tools? will it run after building like creating jar file and then run on server ? normally test automation suite dont create any jar/some files ...they just run like application Please let me know more on it.

答案1

得分: 0

让我们假设您在机器A上设置了Jenkins --> 这个Jenkins可以称为控制器或主控。控制器将向工作机/代理推送命令以实际执行任务。在安装了Jenkins的机器上,有两个空闲的工作机。

  • 在Jenkins中,您将定义实现目标的步骤(称为作业)。在您的情况下,这是自动化测试。步骤将是:下载源代码 --> 运行mvn命令 --> 发布报告。

  • 要运行作业,您必须手动或自动触发作业(计划)。Jenkins代理将接收并运行定义的步骤,例如:

git pull

cd .\auto-test
mvn clean verify

在我看来,Jenkins代理只是调用CLI模式中的另一个工具,例如git、maven...

  • 在这种情况下,如果您想在机器B上运行测试,那么您必须将机器B设置为Jenkins的代理,在作业配置中,您必须定义运行测试的代理是机器B。
英文:

Let's say you set up Jenkins in a machine A --> This Jenkins can be called Controller or Master. Controller will push the command to Worker/Agent to actually do the job. In the machine that installed Jenkins, there are 2 idle workers.

  • In Jenkins, you will define steps to achieve your goal (it's called a job). In your case, it's automation test. The steps would be: down source code --> run mvn command --> publish report.

  • To run the job, you have to trigger the job manually or automatically (schedule). Jenkins agent will pick up and run the defined steps, for example:

git pull

cd .\auto-test
mvn clean verify

In my view, Jenkins agent is just a tool to call another tools in CLI mode, e.g git, maven ...

  • In the case, you want to want to run test in machine B, then you have to setup machine B as an agent of Jenkins, and in the job configuration, you have to define agent to run test is machine B.

huangapple
  • 本文由 发表于 2023年7月20日 18:40:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/76729063.html
匿名

发表评论

匿名网友

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

确定