Some calculators, with ATSes

There a two calculator examples

  1. A WebApp: A html-page, to run in your browser

  2. A xmlrcp server: a deamon to offload your client

Both have (almost) the same, limited functionality

  • Add, subtract, multiply, divide; mainly (positive) integers only

  • Both requerer to ‘login’ first!

Although these ‘products’ are almost trivial, and have a useless ‘login’ feature; they are great examples to show the Pathways concept.

XXXXXX

sectionauthor

Erik Jan, Albert Mietus

Installation

  1. install firefox

  2. install python (latest version)

  3. install PIP (usually installed with Python, but not always)

  4. add python to your path (http://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows-7)

  5. add PIP to path (same as previous step, but now the folder C:/Python3x/Scripts

  6. Install selenium (open command window and tupe: ‘pip install selenium’

  7. Unpack the Pathways-.zip file

webapp1

Edit the ini file .../calculators/webapp/tst/ATS/config.cfg

server1

Edit the ini file .../calculators/server/tst/ATS/config.cfg

### (C)  Part of Pathways project

[DEFAULT]

# My file/dir base
#######EDIT ME########
TOPd	:	C:\Pathways\pathways_all\
#######STOP HERE######
CALCd	: ${TOPd}examples/calculators/

# some locations, extending/using the shared.cfg setting

PLUGINd	      : ./
SHARED-DATAd  : ${CALCd}/tst/tst-data/

# Log a lot, but not to much
log = INFO

[ATS]
gate    = ${PLUGINd}:plugin.gate.rekenServer:RekenServer
put	= http://localhost:37421

First Run

webapp2

  1. open command window

  2. navigate to yourpathwaypath/examples/calculators/webapp/tst

  3. type python ATS/telop.py --vector ../../tst/tst-data/telop.csv The test should run and a firefox window opens where you see the calculator. In the end you should see ‘==ALL test are run OK’ in de commandline

server2

Here the a deamon/service kind of product is tested; which is support to run forever. So to test it, we have to start it manually:

  1. Open a (new) command window any shell on unix, ‘cmd’ on windows

  2. Navigate to .../calculators/server/src/

  3. Start the server: python ./rekenServer.py

Now, we can execute the tests, as normally. This is done is a separate window/shell/cmd-box

  • Open a (new) command window any shell on unix, ‘cmd’ on windows

  • Navigate to .../calculators/server/tst/

Several test are available:

  • python ATS/logInUit.py --vector ../../tst/tst-data/sessie.csv

  • python ATS/logInUit.py --vector ../../tst/tst-data/login.csv

  • python ATS/optellen.py --vector ../../tst/tst-data/telop.csv

All these test should pass and should report –ALL test are run OK

Tip

When using a proper shell, the ‘python’ part is not needed. Using ATS/<test>.py has the same effect, with less typing.

Note

For those that didn’t add python to the PATH; the full path to the python has to be specified. It has to be python-3! (3.4 or later)

Hint

It is possible to check whether the server runs, is reachable, by running command:python connect_test.py. When it give errors, the ATSes will fail to.