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"
    
  • 相关阅读:
    Accoridion折叠面板
    mui列表系列
    按照中文首字母排序查询表数据
    五分位算法
    springmvc添加拦截器
    springmvc添加定时任务
    通过后台解决跨域调用接口问题
    eclipse搭建ssm框架
    Java 将图片转成base64,传到前台展示
    用mysql存储过程代替递归查询
  • 原文地址:https://www.cnblogs.com/z1500592/p/6022692.html
Copyright © 2011-2022 走看看