简体   繁体   中英

How to pass Jenkins configurations to overwrite Automation Configuration

I have a project which have Grid + Selenium + Java + Testng + maven. Is there is a way to set up, that the person who will run test he will be able to pass his own configurations which will overwrite default configs?

Here is my testng.xml file which i`m running:

<suite name="TestSuite" parallel="tests">


    <test name="firefox test">
        <parameters>
            <parameter name="platform" value="MAC" />
            <parameter name="browser" value="firefox" />
            <parameter name="version" value="50.1.0" />
            <parameter name="url" value="google.com" />
        </parameters>
        <classes>
            <class name="com.ParallelTest.CreateRandomProfileTest"/>
            <class name="com.ParallelTest.LogInTest">

            </class>
        </classes>
    </test>




</suite>

For example if someone will want to run 5 Tests against Chrome on Win? How to pass it without changing the code and where it should be overwritten. Can someone drop me a link for resources where i can check it? Thanks!

It can be done easily by file parameter plugin of Jenkins.

https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build

Ie, Lets assume this a workspace with default folder structure

data
pageobjects
tests
suite.xml

now an user uploads his own version of suite.xml and run the job.

Jenkins will pull the project from source control/github and replaces the suite.xml with the one uploaded by the user and runs the project.


You could try this way as well.

Pass variable from jenkins to testng.xml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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