zoukankan      html  css  js  c++  java
  • perfecto使用

    总配置

    application.properties

    env.resources=src/main/resources/common #配置resource文件所在目录,如.loc定位文件
    resources.load.subdirs=2 #配置加载子目录层次
    scenario.file.loc=src/main/resources/scenarios #配置场景.feature文件目录
    step.provider.pkg=com.quantum.steps #配置自定义关键字包
    driver.name=chromeDriver #配置driver的名称
    webdriver.chrome.driver=D:/xx/xx/chromedriver.exe #配置diver位置
    driver.pluginType=intellij #指定IDE
    driver.init.retry.timeout=60 #指定timeout
    selenium.wait.timeout=15000 #指定wait.timeout
    selenium.success.screenshots=0 #指定成功是否截图
    wd.command.listeners=com.quantum.listeners.PerfectoDriverListener #指定监听器
    teststep.listeners=com.quantum.listeners.QuantumReportiumListener #指定监听器
    
    ##When enabled your test will be retried from the start
    ##customizations can be made to your own personal retry analyzer - please see the documentation on our github wiki page
    ##https://github.com/Project-Quantum/Quantum-Starter-Kit/wiki
    #retry.count=1
    #retry.analyzer=com.quantum.utils.Retry
    
    ##user proxy for API calls - enable this and set you proxy details 
    ##if you encounter unexpected errors when downloading perfecto reports
    #proxyHost=127.0.0.1
    #proxyPort=8888
    #proxyUser=1
    #proxyPassword=1
    
    ##enable to turn on parallel data providers
    ##you must also define in testNg.xml the data provider thread count
    ##<suite name=....... data-provider-thread-count="10">
    #global.datadriven.parallel=true
    
    ##set true to fill bean randomly from set of test-data
    #bean.populate.random=false
    
    ##set 1 to suppress success log, when 0 it will also show verification success message
    report.log.skip.success=0
    
    ##Use this key to add test data in the scenario names for Reportium results
    #addFullDataToReport=true
    
    ##Use this key to pass the skipped tests, by default all the skipped tests will be marked as fail in reportium
    #skippedTests=pass
    
    #perfecto.capabilities.user=yourname@xxx.com
    ##generate the security token using this document - https://developers.perfectomobile.com/display/PD/Security+Token
    #perfecto.capabilities.securityToken=<<XX_XX_SECURITY_TOKEN>>
    #perfecto.capabilities.password=yourpassword
    #perfecto.capabilities.automationName=Appium
    #perfecto.capabilities.browserName=MobileOS
    
    ##switch download reports true/false to download reports.
    #perfecto.download.reports=false
    #perfecto.download.summaryReports=false
    #perfecto.download.video=false
    #perfecto.download.attachments=false
    #perfecto.report.location= perfectoReports
    #perfecto.offlineToken= <<CQ_LAB_SECURITY_TOKEN>>
    

    在指定的步骤包中自定义步骤(关键字)

    	@Then("I switch to "(.*?)" frame by element")
    	public static void switchToFrameByElement(String loc) {
    		new WebDriverTestBase().getDriver().switchTo().frame(new QAFExtendedWebElement(loc));
    	}
    

    在指定的resource文件夹中编写.loc元素定位文件

    #input.box = xpath=//input[@id='kw']
    input.box = id=kw
    #search.button=["xpath=//input[@id='su']","xpath=//button[@aria-label='Baidu Search']"]
    search.button = ["xpath=//input[@id='su']"]
    

    在指定的场景目录中编写.feature文件

    @BaiduSearch
    Feature: Baidu Search
      Scenario: Search CSDN
        Given I open browser to webpage "https://www.baidu.com/"
        Then I enter "CSDN" to "input.box"
        Then I click on "search.button"
        Then I wait for "5" seconds
    

    配置TestNG的xml文件

    在TestNG的xml文件中调用@BaiduSearch注解,同时可修改application.properties中的属性,如.loc的目录

    <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
    <suite name="Baidu Search Demo Suite" verbose="0" parallel="tests"
           thread-count="100">
        <listeners>
            <listener class-name="com.quantum.listeners.QuantumReportiumListener"/>
        </listeners>
    
        <test name="Web Scenarios Test" enabled="true" thread-count="10">
            <parameter name="env.resources" value="src/main/resources/baidu"/>
            <groups>
                <run>
                    <include name="@BaiduSearch"/>
                </run>
            </groups>
            <classes>
                <class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory"/>
            </classes>
        </test>
    </suite>
    

    Refer

    https://blog.csdn.net/Cupupup/article/details/80154544

  • 相关阅读:
    移植Valgrind检测Android JNI内存泄漏
    【转】线性回归最小二乘法和梯度下降法
    【转】成为一名推荐系统工程师永远都不晚
    vue-element-admin使用常见问题
    SpringBoot中如何使用jpa和jpa的相关知识总结
    SpringBoot Controller接收参数的几种常用方式
    java项目其他基础配置
    eclipse 新建 maven 项目 + 消除错误
    vue城市三级联动组件 vue-area-linkage
    Vue中watch的简单应用
  • 原文地址:https://www.cnblogs.com/liehen2046/p/11176679.html
Copyright © 2011-2022 走看看