Some calculators, with ATSes¶
There a two calculator examples
A WebApp: A html-page, to run in your browser
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¶
install firefox
install python (latest version)
install PIP (usually installed with Python, but not always)
add python to your path (http://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows-7)
add PIP to path (same as previous step, but now the folder C:/Python3x/Scripts
Install selenium (open command window and tupe: ‘pip install selenium’
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¶
open command window
navigate to yourpathwaypath/examples/calculators/webapp/tst
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:
Open a (new) command window any shell on unix, ‘cmd’ on windows
Navigate to
.../calculators/server/src/
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.