zoukankan      html  css  js  c++  java
  • 动态修改所有的endpoint (Dynamically update all endpoint in each test suite with properties file)

    1. 选择自己的project,在'Project Properties'中将'Resource Root'设置为'${projectDir}'

    2. 在project同目录下创建mockServices.properties文件,并定义MY_ENDPOINT=http://x.x.x.x:port/webservice

    3. 将下边的代码放在project的'Load Script'中

    4. 重新加载project

    def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
    def projectDir = groovyUtils.projectPath
    
    def myProperties = new java.util.Properties();
    myProperties.load(new FileInputStream(projectDir+"/mockServices.properties"));
    
    def myEndpoint = myProperties["MY_ENDPOINT"]
    log.info(myEndpoint)
    /*
     @Author : Pradeep Bishnoi
     @Description : Setting my customized endpoint URL
    @Usage : Place the script in the Project Load/Save script section
    */
    
     testSuiteList = project.getTestSuites()
     log.info(testSuiteList)
     text = "~"
     testSuiteList.each
     {
     testSuite = project.getTestSuiteByName(it.key)
     testCaseList = testSuite.getTestCases()
     log.info " ${text*5} TestSuite :: $testSuite.name"
     testCaseList.each
      {
      testCase = testSuite.getTestCaseByName(it.key)
      log.info " ${text*5} Testcase :: $testCase.name"
     
      wsdlTestSteps = testCase.getTestStepsOfType( com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep.class )  //only WsdlTestRequest steps
      wsdlTestSteps.each
       {
       //log.info it.properties['Endpoint'].value
       it.properties['Endpoint'].value = myEndpoint
       }
      }
     }
     
    log.info "All the endpoints are now : $myEndpoint"
    
  • 相关阅读:
    Tomcat性能优化总结
    shell 服务器监控 cpu 和 java 占用 CPU 脚本
    编写shell时,遇到let: not found错误及解决办法
    Studio 3T 破解 mogodb
    nginx/iptables动态IP黑白名单实现方案
    创业公司这两年
    致所有的开发者们
    如何成为一名全栈开发工程师
    谈谈在创业公司的几点感触
    推荐阅读《赢在下班后》
  • 原文地址:https://www.cnblogs.com/z1500592/p/6022692.html
Copyright © 2011-2022 走看看