- Why and What
- Technologies
- Getting Started with Zalenium
- Getting Started with Test Cases
- Docker Run Parameters
- Checkout If Tests Are Too Slow
- This project created for study purposes and simulates user actions on hurriyetemlak.com (which is a real estate advertizement website) such as checking for getting advertisement information, filter usage and taking a close look to published advertizements.
- Project uses browser user-agent information to simulate platforms like Linux, Macintosh, Android, Chrome and Safari on screen resolutions such as 1920x1080, 1366x768, 360x640, 375x667.
- After setting up you can watch tests live at localhost:4444/grid/live/admin or you can watch replays of test cases at http://localhost:4444/dashboard.
- And don't forget that zalenium docker image has to be running first before you run the test cases.
- IntelliJ Idea
- Selenium
- TestNG
- Zalenium
- Docker
- Following steps will be explaining how to setup your Zalenium environment, how to clone this project and run in on your system. (This readMe file is partially created by help of this documentation.)
- Docker engine running, version >= 1.11.1 (probably works with earlier versions, not tested yet).
- Make sure your docker daemon is running (e.g. docker info works without errors).
- Pull the docker-selenium image.
# Pull docker-selenium
$ docker pull elgalu/selenium
# Pull Zalenium
$ docker pull dosel/zalenium
- Zalenium uses docker to scale on-demand, therefore we need to give it the docker.sock full access, this is known as "Docker alongside docker".
$ docker run --rm -ti --name zalenium -p 4444:4444 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/videos:/home/seluser/videos \
--privileged dosel/zalenium start
If everything is fine you should see something like this in your terminal.(this image generated with "--desiredContainers 8" parameter.)
- In case of you'd like to run tests with docker instead of maven or from IDE, docker image of tests can be found on koulgar/hurriyettest and can be pulled and runned with commands such as;
# Pull Docker Image
$ docker pull koulgar/hurriyettest
# Run Docker Image
$ docker run --rm -ti --net=host koulgar/hurriyettest
- This part explains how to clone this project from Github and run it on your system and in case of it's running too slow on your system will contain additional information to reduce source usage.
- Go to your folder that you desire project to be in.
- Clone project from Github.
$ git clone https://github.com/koulgar/HurriyetEmlakStudyCase
- Installing maven,
- Importing project as maven project.
- Go to your project folder and use command below in order to build.
$ mvn clean package
- Run "testng.xml" file inside your IDE to run all test cases.
- or
- Use terminal with following command,
$ mvn clean test -Dsurefire.suiteXmlFiles=<Full path to your testng.xml file>
- --rm - remove container automatically after it exits
- --ti - connect the container to terminal
- --name - name the container
- -p (x):(y) - expose port x externally and map to port y
- -v - create a host mapped volume inside the container
- --privileged - gives all the capabilities to the container and also access to the host’s devices
- --desiredContainers - Number of nodes/containers created on startup (2 is default value.)
- On docker run parameters "--desiredContainers 8" is not a default parameter. In case of test process takes too long on your system you can just use fewer containers instead of "8" or just delete whole parameter for default value which is assigned as "2". In this case you should see something like this when you run docker image.
- Another option is to use fewer threads in your "testng.xml" file. Threads are amount of simultaneous test process that your system will run. Which in this project it's assigned as "8". Using fewer threads such as "3" will ease down things. You can see location of "threads" parameter below.