Forum Discussion

Happy's avatar
Happy
Contributor
9 years ago

Change Properties for new test project

I have test step Properties in test project. I use test project for two different customer and need only to change Properties. How to implement changing of properties for every new test project. I run test on Jenkins.

  • It can be implemented using Groovy step.

     

    // get value
    def project = testRunner.getTestCase().getTestSuite().getProject()
    def value = "name" + project.properties['value'].value 
    
    // set values 
    testRunner.testCase.getTestStepByName("step1").setPropertyValue("Username", value)
    testRunner.testCase.getTestStepByName("step1").setPropertyValue("Password", value)

     

  • nmrao's avatar
    nmrao
    Champion Level 3
    Perhaps, you may keep those properties at project level and keep different property files as per the customer specific and load the properties in the Load script of the project. So this would be dynamic.
  • Happy's avatar
    Happy
    Contributor

    It can be implemented using Groovy step.

     

    // get value
    def project = testRunner.getTestCase().getTestSuite().getProject()
    def value = "name" + project.properties['value'].value 
    
    // set values 
    testRunner.testCase.getTestStepByName("step1").setPropertyValue("Username", value)
    testRunner.testCase.getTestStepByName("step1").setPropertyValue("Password", value)