<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      WebUI 自動化配置

      前言

      由于項目情況以及時間問題,本篇暫時僅用于記錄當時web項目自動化配置相關信息(歷史篇:在草稿箱存了老久了??)

      一、Selenium + TestNG 配置

      Java 工程的 pom 文件配置信息

      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      
      <groupId>auto-tests</groupId>
      <artifactId>auto-test-punish</artifactId>
      <version>1.0-SNAPSHOT</version>
      
      <properties>
            <maven.compiler.target>1.8</maven.compiler.target>
            <maven.compiler.source>1.8</maven.compiler.source>
            <!-- 文件拷貝時的編碼 -->
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
            <!-- 編譯時的編碼 -->
            <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
            <aspectj.version>1.8.10</aspectj.version>
            <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
      </properties>
      
      
      <dependencies>
            <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
            <dependency>
                  <groupId>org.seleniumhq.selenium</groupId>
                  <artifactId>selenium-java</artifactId>
                  <version>3.141.59</version>
            </dependency>
            <!--testng 配置, 配置最新版本報錯 RELEASE -->
            <dependency>
                  <groupId>org.testng</groupId>
                  <artifactId>testng</artifactId>
                  <version>6.14.3</version>
            </dependency>
      
            <!-- allure 生成報告 mvn io.qameta.allure:allure-maven:serve -->
            <dependency>
                  <groupId>io.qameta.allure</groupId>
                  <artifactId>allure-testng</artifactId>
                  <version>2.13.0</version>
            </dependency>
      
            <!-- fast json -->
            <dependency>
                  <groupId>com.alibaba</groupId>
                  <artifactId>fastjson</artifactId>
                  <version>1.2.62</version>
            </dependency>
      
            <!-- slf4j 日志門面,無具體實現
            <dependency>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-api</artifactId>
                  <version>1.7.2</version>
            </dependency>
            -->
      
            <!-- log4J 無法格式化日志輸出
            <dependency>
                  <groupId>log4j</groupId>
                  <artifactId>log4j</artifactId>
                  <version>1.2.16</version>
            </dependency>
            -->
      
            <dependency>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-log4j12</artifactId>
                  <version>1.7.2</version>
            </dependency>
      
            <!-- apache io 處理 -->
            <dependency>
                  <groupId>commons-io</groupId>
                  <artifactId>commons-io</artifactId>
                  <version>2.6</version>
            </dependency>
      </dependencies>
      
      <!-- 打包配置 mvn package assembly:single; mvn clean install 會install 到 maven 倉庫-->
      <build>
            <resources>
                  <resource>
                        <directory>src/main/resources</directory>
                        <filtering>true</filtering>
                        <includes>
                              <include>log4j.properties</include>
                        </includes>
                  </resource>
            </resources>
      
            <plugins>
                  <!-- 指定maven JDK 編譯版本 -->
                  <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.1</version>
                        <configuration>
                              <source>1.8</source>
                              <target>1.8</target>
                              <encoding>UTF8</encoding>
                        </configuration>
                  </plugin>
      
                  <plugin>
                        <!-- maven-surefire-plugin 用于 allure 查找測試用例 -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.22.1</version>
                        <configuration>
                              <!-- 測試失敗后,是否忽略并繼續測試 -->
                              <testFailureIgnore>true</testFailureIgnore>
                              <suiteXmlFiles>
                                    <!-- testng 配置文件名稱 src 路徑后續修改-->
                                    <suiteXmlFile>testng.xml</suiteXmlFile>
                              </suiteXmlFiles>
      
                              <!--設置參數命令行 -->
                              <argLine>
                                    <!-- UTF-8編碼 -->
                                    -Dfile.encoding=UTF-8
                                    <!-- 配置攔截器 -->
                                    -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                              </argLine>
      
                              <systemPropertyVariables>
                                    <!-- 配置 allure 結果存儲路徑, 且會覆蓋 allure 中的配置-->
                                    <allure.results.directory>${project.build.directory}/allure-results/${maven.build.timestamp}</allure.results.directory>
                              </systemPropertyVariables>
                        </configuration>
      
                        <dependencies>
                              <dependency>
                                    <groupId>org.aspectj</groupId>
                                    <artifactId>aspectjweaver</artifactId>
                                    <version>${aspectj.version}</version>
                              </dependency>
                        </dependencies>
                  </plugin>
      
                  <!-- maven-assembly-plugin 支持自定義的打包結構插件 -->
                  <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.5.5</version>
                        <configuration>
                              <archive>
                                    <manifest>
                                          <mainClass>com.zzw.PunishCenterTest</mainClass>
                                    </manifest>
                              </archive>
                              <descriptorRefs>
                                    <descriptorRef>jar-with-dependencies</descriptorRef>
                              </descriptorRefs>
                        </configuration>
                        <executions>
                              <execution>
                                    <id>make-assembly</id>
                                    <phase>package</phase>
                                    <goals>
                                          <goal>single</goal>
                                    </goals>
                              </execution>
                        </executions>
                  </plugin>
            </plugins>
      </build>
      
      </project>
      
      

      二、Allure 報告

      • 簡介

      官網 http://allure.qatools.ru/
      文檔  https://docs.qameta.io/allure/
      下載  https://github.com/allure-framework/allure2/releases
      下載后配置環境變量,即可使用 allure 命令

      <properties> 
            <aspectj.version>1.8.10</aspectj.version> 
            <!-- 與下列 allure 結果生成有關 --> 
            <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
      </properties>
      
      <dependencies> 
            <dependency> 
            <groupId>io.qameta.allure</groupId> 
            <artifactId>allure-testng</artifactId> 
            <version>2.13.0</version> 
            <!-- <scope>test</scope> 只限于 test 測試包 --> 
            </dependency>
      </dependencies>
      
      <build> 
            <plugins> 
                  <plugin> 
                  <groupId>org.apache.maven.plugins</groupId> 
                  <artifactId>maven-surefire-plugin</artifactId> 
                  <version>2.20</version> 
                  <configuration> 
                        <argLine> -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"</argLine> 
                        <systemPropertyVariables> 
                              <!-- 配置 allure 結果存儲路徑, 且會覆蓋 allure 中的配置-->
                              <allure.results.directory>${project.build.directory}/allure-results/${maven.build.timestamp}</allure.results.directory>
                        </systemPropertyVariables> 
                  </configuration> 
                  <dependencies> 
                        <dependency> 
                        <groupId>org.aspectj</groupId> 
                        <artifactId>aspectjweaver</artifactId> 
                        <version>${aspectj.version}</version> 
                        </dependency> 
                  </dependencies> 
            </plugin> 
            </plugins>
      </build>
      
      • 使用
        命令行幫助文檔

      格式:   allure [options] [command] [command options]

      Options: 
            --help 打印命令行幫助信息 
            -q, --quiet 打開靜音模式,默認為 false 
            -v, --verbose 打開詳細模式,默認為 false 
            --version 打印 allure 版本號 
      Commands: 
            generate 生成報告命令 
            Usage: generate [options] 生成的 allure 結果目錄 
            Options: 
                  -c, --clean 在生成新的 Allure 報告目錄之前,清除該目錄. 默認不清除 
                  --config Allure 命令行配置路徑. 如果通過--profile and --configDirectory 覆蓋指定值 
                  --configDirectory Allure命令行配置目錄。默認使用ALLURE_HOME 目錄. 
                  --profile Allure 命令行配置文件 
                  -o, --report-dir, --output 生成 Allure 報告的目錄. 默認為 allure-report 
      
            serve 報告服務命令 
            Usage: serve [options] The directories with allure results 
            Options: 
                  --config Allure 命令行配置路徑. 如果通過--profile and --configDirectory 覆蓋指定值 
                  --configDirectory Allure命令行配置目錄。默認使用ALLURE_HOME 目錄. 
                  -h, --host 指定用于啟動報告 web 服務的主機 
                  -p, --port 指定用于啟動報告 web 服務的端口,默認為 0 
                  --profile Allure 命令行配置文件 
      
            open 打開生成的報告 
            Usage: open [options] 報告目錄 
            Options: 
                 -h, --host 指定用于啟動報告 web 服務的主機 
                 -p, --port T指定用于啟動報告 web 服務的端口,默認為 0 
      
            plugin 生成報告 
            Usage: plugin [options] 
            Options: 
                  --config Allure 命令行配置路徑. 如果通過--profile and --configDirectory 覆蓋指定值 
                  --configDirectory Allure命令行配置目錄。默認使用ALLURE_HOME 目錄. 
                  --profile Allure 命令行配置文件
      
      • 實例
        手動生成測試報告,-c 清除 -o 指定輸出報告目錄
        allure generate -c <directory-with-results> -o <directory-with-report>

      三、ChromeDriver 相關(待歸納)

      ChromeOptions options = new ChromeOptions();
      // Chrome 75 版本以下 
      // options.addArguments("disable-infobars");
      // Chrome 75 版本以上, 去除自動化控制 
      options.setExperimentalOption("useAutomationExtension", false); 
      options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation")); 
      // 去除密碼保存提示
      Map<String, Object> prefs = new HashMap<String, Object>();
      prefs.put("credentials_enable_service", false);
      prefs.put("profile.password_manager_enabled", false);
      options.setExperimentalOption("prefs", prefs);
      // 直接最大化
      options.addArguments("start-maximized");
      // 去除 [SEVERE]: Timed out receiving message from renderer: 0.100 信息
      // https://stackoverflow.com/questions/61201270/timed-out-receiving-message-from-renderer-in-selenium
      System.setProperty(ChromeDriverService.CHROME_DRIVER_SILENT_OUTPUT_PROPERTY, "true");
      System.setProperty(ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY, "D:\\tools\\Python\\Python37\\chromedriver.exe");
      
      ChromeDriver chrome = new ChromeDriver(options);
      // 會有個變化過程
      // chrome.manage().window().maximize();
      EventFiringWebDriver eventFiringWebDriver = new EventFiringWebDriver(chrome);
      eventFiringWebDriver.register(new WebEventListener());
      driver = eventFiringWebDriver;
      
      posted @ 2020-05-26 22:05  zeotoone  閱讀(229)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 亚洲国产精品18久久久久久| 亚洲av激情一区二区| 久久人人爽人人爽人人av| 在线a人片免费观看| 吉川爱美一区二区三区视频| 狠狠躁日日躁夜夜躁欧美老妇| 亚洲人成网站18禁止无码| 国产喷水1区2区3区咪咪爱av| 99久久精品看国产一区| 九九热在线观看视频免费| 中文字幕人妻中出制服诱惑| 久久中文字幕一区二区| 中文字幕乱偷无码av先锋蜜桃| 少妇夜夜春夜夜爽试看视频| 日韩精品区一区二区三vr| 熟妇的奶头又大又长奶水视频| 国产精品日日摸夜夜添夜夜添无码| 黑人巨茎大战欧美白妇| 在线成人国产天堂精品av| 亚洲av永久无码精品水牛影视 | 久久成人 久久鬼色| 亚洲人成人日韩中文字幕| 忘忧草在线社区www中国中文 | 亚洲V天堂V手机在线| 龙口市| 日本高清不卡一区二区三| 久久精品国产蜜臀av| 亚洲人成在线播放网站| 亚洲性人人天天夜夜摸18禁止 | 亚洲婷婷综合色高清在线| 国产最大成人亚洲精品| 一区二区三区四区激情视频| 亚洲中文字幕第二十三页| 亚洲aⅴ无码专区在线观看q| 国产精品中文字幕第一区| 色偷偷女人的天堂亚洲网| аⅴ天堂中文在线网| 五月丁香啪啪| 亚洲精品久久久久成人2007| 亚洲一级特黄大片在线观看| 国产精品无码a∨麻豆|