Child pages
  • Pyforge Installation Guide

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Pyforge is a python-based functional testing framework used by IG QA. It is also very useful in quickly configuring an environment representing a particular use-case.

To install:

Install HomeBrew:

Code Block
languagebash
titleinstall HomeBrew
collapsetrue
15:10:05 2 $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:

If this error occurs, sadly you will have to install xcode (1hr?), open and accept licence:

Code Block
languagebash
titleinstall HomeBrew error
collapsetrue
  : No such update
  No updates are available.
  ==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
  ==> /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
  xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'
  Failed during: /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools

You will then need to reinstall after xcode licence acceptance

Code Block
languagebash
titleHomeBrew reinstall
collapsetrue
15:37:23 16 $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  ...
  ==> Installation successful!

  ==> Homebrew has enabled anonymous aggregate user behaviour analytics.
  Read the analytics documentation (and how to opt-out) here:
    https://docs.brew.sh/Analytics.html

  ==> Next steps:
  - Run `brew help` to get started
  - Further documentation:
      https://docs.brew.sh

Install python

...

Code Block
languagebash
titleinstall python
collapsetrue
15:40:24 18 $ brew install python
  ...
  Pip and setuptools have been installed. To update them
    pip2 install --upgrade pip setuptools

  You can install Python packages with
    pip2 install <package>

  They will install into the site-package directory
    /usr/local/lib/python2.7/site-packages

  See: https://docs.brew.sh/Homebrew-and-Python.html
  ==> Summary
  ??  /usr/local/Cellar/python/2.7.14: 6,344 files, 87.5MB, built in 2 minutes 20 seconds

Update bash

Code Block
languagebash
titleconfigure .bash_profile
collapsetrue
# update .bash_profile
15:43:03 19 $ vi ~/.bash_profile
15:44:48 20 $ source ~/.bash_profile
15:44:53 21 $ which python
/usr/local/opt/python/libexec/bin/python
15:45:00 22 $ which pip
/usr/local/opt/python/libexec/bin/pip

Set-up Pyforge

Code Block
languagebash
titlesetup pyforge
collapsetrue
15:45:28 24 $ cd ~/dev/pyforge/
15:45:31 25 $ ls
  PyBot				configure.py			run-pybot.py
  README.md			docs				run-rebot.py
  archives			lib				scripts
  cleanup.py			requirements			sonar-project.properties
  config				results

# configure and see archiving
15:45:32 26 $ ./configure.py
15:46:04 26 $ ls archives/
[empty]
15:46:30 29 $ ./configure.py
    ********************************************************************************
                                  configure.py
    ********************************************************************************

    --------------------------------------------------------------------------------
    Checking if pip is installed...
    --------------------------------------------------------------------------------
  pip (9.0.1) is correctly installed

  --------------------------------------------------------------------------------
  Checking if unzip is installed...
  --------------------------------------------------------------------------------
  unzip is correctly installed

  --------------------------------------------------------------------------------
  Checking if gcc is installed...
  --------------------------------------------------------------------------------
  gcc is correctly installed

  --------------------------------------------------------------------------------
  Installing requirements...
  --------------------------------------------------------------------------------
  pip install --no-cache-dir --upgrade --user -r "/Users/wayne.morrison/dev/pyforge/requirements/PyForge.txt"
  All requirements in PyForge.txt have been installed.

  --------------------------------------------------------------------------------
  Installing selenium drivers...
  --------------------------------------------------------------------------------

  --------------------------------------------------------------------------------
  Selenium driver : chromedriver installation
  --------------------------------------------------------------------------------
  chromedriver is correctly installed

  --------------------------------------------------------------------------------
  Selenium driver : geckodriver installation
  --------------------------------------------------------------------------------
  geckodriver is correctly installed

  --------------------------------------------------------------------------------
  Generating config/config.cfg...
  --------------------------------------------------------------------------------
  Generate config file "/Users/wayne.morrison/dev/pyforge/config/config.cfg"
  Cannot find fqdn in 'waynemorrisons-MacBook-Pro.local',  reverting to 'localhost'

Confirm localhosts has entries as expected for products

Code Block
languagebash
titlePrior hosts configuration
collapsetrue
15:49:22 30 $ cat /etc/hosts
  ##
  # Host Database
  #
  # localhost is used to configure the loopback interface
  # when the system is booting.  Do not change this entry.
  ##
  127.0.0.1	localhost	waynemorrisons-MacBook-Pro
  255.255.255.255	broadcasthost
  ::1             localhost	waynemorrisons-MacBook-Pro

...

Change to:

Code Block
languagebash
titletest hosts
collapsetrue
  ##
  # Host Database
  #
  # localhost is used to configure the loopback interface
  # when the system is booting.  Do not change this entry.
  ##
  127.0.0.1	localhost	waynemorrisons-MacBook-Pro	waynemorrisons-MacBook-Pro.local	openam.example.com  openig.example.com  opendj.example.com  app.example.com  openidm.example.com  sp.example.com  sp1.example.com  sp2.example.com
  255.255.255.255	broadcasthost
  ::1             localhost	waynemorrisons-MacBook-Pro	waynemorrisons-MacBook-Pro.local

Configure config/config.cfg for your host names and product versions

Run Pyforge tests

Run functional tests sample with run-pybot.py:

Code Block
languagebash
titleTest Pyforge install
collapsetrue
  15:55:49 38 $ ./run-pybot.py -s Sample.Basic ig
  ********************************************************************************
                                run-pybot.py
  ********************************************************************************
  cmd: run-pybot.py -s Sample.Basic ig

  While the tests are running you may tail the debug log at:
  /Users/wayne.morrison/dev/pyforge/results/20170926-155641/debug.txt

  ================================================================================================================
  OpenIG
  ================================================================================================================
  OpenIG.Functional :: Functional Tests Root
  ================================================================================================================
  OpenIG.Functional.Sample
  ================================================================================================================
  OpenIG.Functional.Sample.Basic
  ================================================================================================================
  Missing_Config                                                                                          | PASS |
  ----------------------------------------------------------------------------------------------------------------
  Wrong_Config                                                                                            | PASS |
  ----------------------------------------------------------------------------------------------------------------
  Pure_Proxy_Config                                                                                       | PASS |
  ----------------------------------------------------------------------------------------------------------------
  OpenIG.Functional.Sample.Basic                                                                          | PASS |
  3 critical tests, 3 passed, 0 failed
  3 tests total, 3 passed, 0 failed
  ================================================================================================================
  OpenIG.Functional.Sample                                                                                | PASS |
  3 critical tests, 3 passed, 0 failed
  3 tests total, 3 passed, 0 failed
  ================================================================================================================
  Products Full Version
  OpenDJ: 5.5.0-SNAPSHOT 8c159b9cf44
  OpenIG: 5.5.0-SNAPSHOT 8a9898b5688
  OpenIG.Functional :: Functional Tests Root                                                              | PASS |
  3 critical tests, 3 passed, 0 failed
  3 tests total, 3 passed, 0 failed
  ================================================================================================================
  OpenIG                                                                                                  | PASS |
    3 critical tests, 3 passed, 0 failed
    3 tests total, 3 passed, 0 failed
    ================================================================================================================
    Debug:   /Users/wayne.morrison/dev/pyforge/results/20170926-155641/debug.txt
    Output:  /Users/wayne.morrison/dev/pyforge/results/20170926-155641/output.xml
    Log:     /Users/wayne.morrison/dev/pyforge/results/20170926-155641/log.html
    Report:  /Users/wayne.morrison/dev/pyforge/results/20170926-155641/report.html

# check results/latest for logs etc
  16:02:01 40 $ ls results/
  20170926-155641	data		latest
  16:02:05 41 $ ls results/latest
  Sample		config		debug.txt	log.html	output.xml	report.html	tmp

Run a long-lived manual test (to install products ready to configure):

Code Block
languagebash
titleRunning a Pyforge test
collapsetrue
# running a manual test - long-lived
#
# - ManualTest configured to run ig and am only
# - failures may occur if port taken (or pybot version still running)

  09:47:25 58 $ ./cleanup -f
  ...
  09:47:45 59 $ ./run-pybot.py -s ManualTest -n ig

# Check debug.log for errors.

Docs

...