CSC/ECE 517 Spring 2016/Write automated tests for WebDriver: Difference between revisions
No edit summary |
No edit summary |
||
Line 28: | Line 28: | ||
=== Step 1: === | === Step 1: === | ||
We created a new <code>mach</code> command (<code>test-webdriver</code>) in <code>python/servo/testing_commands.py</code> file. It imports each python file in the directory and executes the <code>test</code> method contained within it. | We created a new <code>mach</code> command (<code>test-webdriver</code>) in <code>python/servo/testing_commands.py</code> file. It imports each python file in the directory and executes the <code>test</code> method contained within it. | ||
=== Step 2: === | === Step 2: === |
Revision as of 00:36, 24 March 2016
Write automated tests for the WebDriver server
ServoServo is an open source prototype web browser layout engine being developed by Mozilla, and it is written in Rust language. It is currently developed on 64bit OS X, 64bit Linux, Android, and Gonk (Firefox OS). The main idea is to create a highly parallel environment, in which different components can be handled by fine grained, isolated tasks. The different components can be rendering, HTML parsing, etc.
Background information:
Python:
Python is a widely used high-level, general-purpose, interpreted, dynamic programming language. Python supports multiple programming paradigms, including object oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library. Modules for creating graphical user interfaces, connecting to relational databases, pseudorandom number generators, arithmetic with arbitrary precision decimals,[77] manipulating regular expressions, and doing unit testing are also included.
WebDriver:
The WebDriver specification defines a communication protocol for automating interactions with a web browser that would traditionally require a human being (eg. clicking the mouse on a particular link; typing text into an input field; etc.) This protocol is being implemented by major browsers such as Firefox, Edge, and Chrome, and Servo also provides a WebDriver server. The goal of this project is both to submit a broad range of automated client tests using the Python WebDriver API that can be run against multiple browsers, and also to report on how many of the tests Servo currently passes.
Scope
- Compile Servo and ensure that it runs on
tests/html/about-mozilla.html
- To run a simple webdriver script using the python client against Servo.
- Create a
mach
command (test-webdriver
) inpython/servo/testing_commands.py
that will import each python file in the directory and execute thetest
method contained within it by invoking the Servo process before running each test, and killing it after each test finishes. - Create a
webdriver
directory undertests
where the forthcoming tests will reside. - Write an automated test for loading a particular URL, asserting that the resulting page is the expected url.
Design pattern
Design patterns are not applicable as our task involved writing automated tests in python. However, the Implementation section below provides details of the steps the way it was implemented.
Implementation
The following steps were followed to meet the project requirements as per this github page.
Step 1:
We created a new mach
command (test-webdriver
) in python/servo/testing_commands.py
file. It imports each python file in the directory and executes the test
method contained within it.
Step 2:
We created tests in test.py and test1.py for loading a particular URL, asserting that the resulting page is the expected url.
Testing
Following are the steps to run the automated tests for WebDriver:
git clone https://github.com/krunal3103/servo
Note: Follow the steps listed in the Readme.md file of this link to clone and build servo on your local machine.
cd servo
./mach test-webdriver
You will see that all tests pass as expected.
Pull Request
Here is our pull request. In the link you can see all code snippets and commits as well as integration test progression information.