These guidelines instruct how to submit issues and contribute code to the Selenium2Library project. Other great ways to contribute include answering questions and participating discussion on robotframework-users mailing list and other forums as well as spreading the word about the framework one way or the other.
Bugs and enhancements are tracked in the issue tracker. If you are unsure if something is a bug or is a feature worth implementing, you can first ask on robotframework-users list. This and other similar forums, not the issue tracker, are also places where to ask general questions.
Before submitting a new issue, it is always a good idea to check is the same bug or enhancement already reported. If it is, please add your comments to the existing issue instead of creating a new one.
Explain the bug you have encountered so that others can understand it and preferably also reproduce it. Key things to have in good bug report:
- Version information
- Selenium2Library, Selenium and Robot Framework version
- Browser type and version.
- Also the driver version, example ChromeDriver version
- Steps to reproduce the problem. With more complex problems it is often a good idea to create a short, self contained, correct example (SSCCE).
- Possible error message and traceback.
Notice that all information in the issue tracker is public. Do not include any confidential information there.
Describe the new feature and use cases for it in as much detail as possible. Especially with larger enhancements, be prepared to contribute the code in form of a pull request as explained below or to pay someone for the work. Consider also would it be better to implement this functionality as a separate tool outside the core framework.
If you have fixed a bug or implemented an enhancement, you can contribute your changes via GitHub's pull requests. This is not restricted to code, on the contrary, fixes and enhancements to documentation_ and tests_ alone are also very valuable.
Choosing something to work on
Often you already have a bug or an enhancement you want to work on in your mind, but you can also look at the issue tracker to find bugs and enhancements submitted by others. The issues vary significantly in complexity and difficulty, so you can try to find something that matches your skill level and knowledge.
On GitHub pull requests are the main mechanism to contribute code. They are easy to use both for the contributor and for person accepting the contribution, and with more complex contributions it is easy also for others to join the discussion. Preconditions for creating a pull requests are having a GitHub account, installing Git and forking the Selenium2Library project.
GitHub has good articles explaining how to set up Git, fork a repository and use pull requests and we do not go through them in more detail. We do, however, recommend to create dedicated branches for pull requests instead of creating them based on the master branch. This is especially important if you plan to work on multiple pull requests at the same time.
Selenium2Library uses the general Python code conventions defined in PEP-8. In addition to that, we try to write idiomatic Python and follow the SOLID principles with all new code. An important guideline is that the code should be clear enough that comments are generally not needed.
Docstrings should be added to public keywords but are not generally needed in internal code. When docstrings are added, they should follow PEP-257. See Documentation section below for more details about documentation syntax, generating docs, etc.
We are pretty picky about using whitespace. We use blank lines and whitespace in expressions as dictated by PEP-8 , but we also follow these rules:
- Indentation using spaces, not tabs.
- No trailing spaces.
- No extra empty lines at the end of the file.
- Files must end with a newline.
The above rules are good with most other code too. Any good editor or IDE can be configured to automatically format files according to them.
With new features or enhancements adequate documentation is as important as the actual functionality. Different documentation is needed depending on the issue.
The main source of documentation should be placed in to the library and individual keywords. But enhancing the internal wiki or other documentation is equally important.
Other keywords and sections in the library introduction can be referenced with internal links created with backticks like `Example Keyword`
When referring to arguments, argument names must use in inline code style created with double backticks like ``argument``.
Examples are recommended whenever the new keyword or enhanced functionality is not trivial.
All new enhancements or changes should have a note telling when the change was introduced. Often adding something like
New in Selenium2Libray 1.8.is enough.
Keyword documentation can be easily created using
script. Resulting docs should be verified before the code is committed.
When submitting a pull request with a new feature or a fix, you should
always include tests for your changes. These tests prove that your changes
work, help prevent bugs in the future, and help document what your changes
do. Depending an the change, you may need
Make sure to run all of the tests before submitting a pull request to be sure
that your changes do not break anything. If you can, test in multiple
browsers and versions (Firefox, Chrome, IE, etc). Pull requests are also
automatically tested on
Most of Selenium2Library's testing is done using acceptance tests that naturally use Robot Framework itself for testing. Every new functionality or fix should generally get one or more acceptance tests. See Unit and acceptance tests for more details about creating and executing them.
Unit tests are great for testing internal logic and should be added when appropriate. For more details see Unit and acceptance tests.
Selenium2Library's continuous integration (CI) servers are visible through travis-ci. They automatically test all new pull request to the repository with Firefox on Python 2.6 and 2.7.
Finalizing pull requests
Once you have code, documentation and tests ready, it is time to finalize the pull request.
If you have done any non-trivial change and would like to be credited, add yourself to CHANGES.rst file.
The most common conflicting file is the aforementioned CHANGES.rst , but luckily fixing those conflicts is typically easy.
If the pull request contains multiple commits, it is recommended that you squash them into a single commit before the pull request is merged. See Squashing Github pull requests into a single commit article for more details about why and how.
Squashing is especially important if the pull request contains lots of temporary commits and changes that have been later reverted or redone. Squashing is not needed if the commit history is clean and individual commits are meaningful alone.