zoukankan      html  css  js  c++  java
  • Automated Front End Test

    1. Install Xvfbm, google-chrome-stable and chromedriver in Jenkins

    sudo apt-get install -y xvfb google-chrome-stable

    Down chromedriver from 

    https://sites.google.com/a/chromium.org/chromedriver/

    The current version running in my jenkins server is 

    Google Chrome version: 54.0.2840.100

    Chrome driver version: 2.25

    Selenium-Java version: 2.53.0

    2. Start Xvfb

    To start Xvfb by command line:

    Xvfb :7 &

    export  DISPLAY=:7

    To start Xvfb for each maven buid

    <profiles>
            <profile>
                <id>cit-environment</id>
                <activation>
                    <activeByDefault>false</activeByDefault>
                    <property>
                        <name>build.environment</name>
                        <value>jenkins</value>
                    </property>
                </activation>
                <build>
                    <plugins>
                        <plugin>
                            <artifactId>maven-antrun-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>start-xvfb</id>
                                    <phase>process-test-classes</phase>
                                    <goals>
                                        <goal>run</goal>
                                    </goals>
                                    <configuration>
                                        <tasks>
                                            <echo message="Starting xvfb" />
                                            <exec executable="Xvfb" spawn="true">
                                                <arg value=":1" />
                                            </exec>
                                        </tasks>
                                    </configuration>
                                </execution>
                                <execution>
                                    <id>shutdown-xvfb</id>
                                    <phase>test</phase>
                                    <goals>
                                        <goal>run</goal>
                                    </goals>
                                    <configuration>
                                        <tasks>
                                            <echo message="Ending xvfb" />
                                            <exec executable="killall">
                                                <arg value="Xvfb" />
                                            </exec>
                                        </tasks>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </build>
            </profile>
        </profiles>
    

    mvn clean install -Dbuild.environment=jenkins will trigger this plugin. Aslo remember to inject DISPLAY env variable during the build.

    3. Issues Observed

    Sometimes selenium just hangs on calling driver = new ChromeDriver(); So the current temporary solution is to try 10 times in a row to bring up chromedriver, and of course this is not nice. 

    Another issue is the page may be loaded too slow in Jenkins, causing the Selenium tests failure. Current temporary solution is to use wait.until method to wait untill an element is available.

  • 相关阅读:
    WINCE6.0+S3C6410睡眠和唤醒的实现
    WINCE6.0+S3C6410的触摸屏驱动
    S3C6410的Bootloader的两个阶段BL1和BL2编译相关学习
    amix vim vimrc 3.6 [_vimrc x64 vim (WorkPlace)]配置
    异常的开销
    A C# Reading List by Eric Lippert (ZZ)
    SQL SERVER 2008中定时备份数据库任务的创建与删除
    ASP.NET26个常用性能优化方法
    如何使用四个语句来提高 SQL Server 的伸缩性
    Cookies揭秘 [Asp.Net, Javascript]
  • 原文地址:https://www.cnblogs.com/codingforum/p/6090446.html
Copyright © 2011-2022 走看看