Forum Discussion

Happy's avatar
Happy
Contributor
10 years ago
Solved

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)

     

2 Replies

  • nmrao's avatar
    nmrao
    Community Hero
    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.
  • 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)