Running Test NG Selenium Tests Through SSH

后端 未结 3 756
萌比男神i
萌比男神i 2021-01-27 00:43

I have a server, A, that has eclipse, testNG, selenium, and stuff set up on it. I have another server, B, with Bamboo setup on it.

I am able to, on server A, run a test

相关标签:
3条回答
  • 2021-01-27 00:52

    Install Xvfb, which pretends to be a monitor, but doesn't show up anywhere.
    sudo apt-get install xvfb.

    If you want less errors add these fonts, but those warning aren't important.
    sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic

    Then start it running and set your display to something the system won't use. Here is what I do, remeber the & makes the terminal run something in the background.
    Xvfb :99 -ac &
    export DISPLAY=:99
    firefox &

    Also I was having problems with a ruby on rails server disconnecting when I quit the ssh terminal. To fix that problem use Screen. Screen runs another terminal without being affected by the ssh.
    sudo apt-get install screen

    Then just start screen before you you do the stuff above.
    screen


    To get out of the current screen window just click "Ctrl + A" then 'D' and to get back in type screen -r.

    0 讨论(0)
  • 2021-01-27 01:04

    Try setting the DISPLAY environment variable to ":0" (or whatever the display is on your machine -- you can check by launching a terminal through the GUI and running "echo $DISPLAY"). I can launch firefox over ssh with the following command:

    ssh somehost "env DISPLAY=:0 firefox"

    But seriously, I second patrungel's suggestion -- use selenium grid / rc. It's designed for this kind of thing.

    0 讨论(0)
  • 2021-01-27 01:14

    Is the below an option for you?

    Host A: have browsers and a selenium-rc always running and listening to whatever (4444) port; Host B: have TestNG + build job and have tests pointing to the selenium-rc of host A.

    That is a regular setup for selenium and ci running on different hosts.

    If server A runs a linux/unix, then just ssh-ing and launching browser (with selenium you'll end up with it trying to launch a browser) will not succeed.

    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题