Forum Discussion
sankarinms
11 years agoNew Contributor
Thanks for your response
I figured out how to pass property value inside a data source:
In the custom properties when creating an environment i set the value of activeEnvironment=staging. Then created another environment named as production and set the value of activeEnvironment=prod
Then in project level i declared a custom property activeEnvironment. In testcase level in setup script , did the following:
def activeEnvironment=context.expand('${#Project#activeEnvironment}')
log.info "activeEnvironment>> "+ activeEnvironment
Then in excel which is a data source gave values like:
http://${#Project#activeEnvironment}/test1
During runtime the url gets replaced with the actual environment value . If it is staging it will be http://staging/test1
If it is prod it is http://prod/test1
Similarly how to use regular expression inside a data source ex: excel with many row. for example: http://(?s).*/test in the
datasource and create an xpath assertion with expected value : ${DataSource#Expected result} and select allow wildcard, it does not recognized that the value provided in the excel is a regular expression. It fails saying match not found. Please let me know.
I figured out how to pass property value inside a data source:
In the custom properties when creating an environment i set the value of activeEnvironment=staging. Then created another environment named as production and set the value of activeEnvironment=prod
Then in project level i declared a custom property activeEnvironment. In testcase level in setup script , did the following:
def activeEnvironment=context.expand('${#Project#activeEnvironment}')
log.info "activeEnvironment>> "+ activeEnvironment
Then in excel which is a data source gave values like:
http://${#Project#activeEnvironment}/test1
During runtime the url gets replaced with the actual environment value . If it is staging it will be http://staging/test1
If it is prod it is http://prod/test1
Similarly how to use regular expression inside a data source ex: excel with many row. for example: http://(?s).*/test in the
datasource and create an xpath assertion with expected value : ${DataSource#Expected result} and select allow wildcard, it does not recognized that the value provided in the excel is a regular expression. It fails saying match not found. Please let me know.
Related Content
Recent Discussions
- 4 days ago