How to Execute Test Scripts on slave based on the filename committed on SCM

流过昼夜 提交于 2019-12-25 04:00:31

问题


SCM - Git, CI - Jenkins

I have configured the Git,Gerrit & Jenkins workflow and configured Automation suite on a jenkins slave.

I am able to run the TestNG suite on the slave machine after a patch set is created on Gerrit.

But currently for any kind of patchset created on Gerrit the same test suite is invoked. What I want to achieve is perform tests based on the file name which was pushed into Gerrit.

eg. If login.jsp is pushed then login tests should be performed not the full test suite.

Any tips on how this can be achieved? The direction in which I am currently thinking is, Is there any way to notify the slave about the name of the pushed file?


回答1:


There is various ways of doing this. You can trigger on paths in the later implementations of the Gerrit trigger plugin.

There is an add file path, in the configuration view.

This way you can have different jobs triggering on different paths.

What i have done in past was to have a .information file in directories where i specify which reviewers to add and which test cases to execute if files below this .information file has changed then i execute specific scripts.

You can find the files modified in a commit with git log -1 --name-status



来源:https://stackoverflow.com/questions/22478388/how-to-execute-test-scripts-on-slave-based-on-the-filename-committed-on-scm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!