问题
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