-
Notifications
You must be signed in to change notification settings - Fork 2
Getting Started
This example project contains a Django website along with some tests that leverage E-gAT. To begin, let's install dependencies, then get Django app running, and finally run the test suite.
Pre-requisites:
- E-gAT and the E-gAT Example Project use Python 2.7.x.
- You will also need to have pip and virtualenv installed.
-
In one terminal, clone the repo and set up the project:
git clone https://github.com/egineering-llc/egat_example_project.git cd egat_example_project virtualenv env # or virtualenv -p <path_to_python2> env source env/bin/activate pip install -r requirements.txt
-
Then in a separate terminal, start the test web app:
cd cms python manage.py runserver
-
Then back in the original terminal, run the test suite:
cd tests egatest -c test_configs\suite.json
-
First off, clone the project:
git clone https://github.com/egineering-llc/egat_example_project.git && cd egat_example_project
-
Then we'll create a virtualenv to keep our Python packages separate from the system ones. For a reference on using pip and virtualenv, see here. This step is technically optional. Note: virtualenv sometimes has problems with spaces in paths on Windows. You can try installing the pywin32 API or removing the spaces.
virtualenv env
Or, if you have multiple versions of Python installed in your main environment, you need to specify the executable for Python 2.x:
virtualenv -p <path_to_python2> env
NOTE: The following step must be done every time a new command prompt is opened for execution on this project.
Linux Environment:
source env/bin/activate
or, Windows Environment (use elevated Windows CMD.exe console...issues seen when using Powershell):
env\Scripts\activate.bat
-
Next we need to install the Python packages we depend on. This is done using pip
pip install -r requirements.txt
-
This project uses Selenium to drive the functional tests. You have already installed the Python API for Selenium with pip, but you will also need Firefox and Chrome installed on your system. In addition, Chrome needs a component named
chromedriver
to interface with Chrome. You can find installation instructions forchromedriver
here.
The Django app is a very simple order management system. It has a few basic models: Customers, Products, Orders, and Payments. These models all support basic CRUD operations, the support for which is all auto-generated by Django. In addition, there is a payment processing page that accepts payment via credit card.
-
We can go ahead and fire up the webserver:
cd cms python manage.py runserver
-
And poke around the website at http://localhost:8000/admin. The username is "admin" and the password is also "admin". The payment processing page is at http://localhost:8000/order_manager
We have a suite of tests already built for the Django application. The rest of this wiki will look at these in more detail, but let's go ahead and run the test suite first.
To run tests with the E-gAT test runner we use the egatest
command. Go ahead and change into the egat_example_project/tests
directory and run the following command:
egatest -c test_configs\suite.json
And you should see browser windows begin to pop up as the tests run. When the tests complete you can find a folder with an html report of the results in the test_results
directory.
Congratulations! You've just executed your first tests with E-gAT using the command line. Optionally, to operate E-gAT from the comfort of an IDE, check out the Setup in IDE page. Otherwise, head to the Login Tests - Basic page to see some of the basic features of E-gAT demoed in a set of authentication tests.
Table of Contents