QA/Mozmill Test Automation/Test Modules Refactor
Jump to navigation
Jump to search
Overview
Lead: | Anthony Hughes |
Co-workers: | TBD |
Dates: | TBD |
Status: | In process of determining style guidelines |
Repository Location: | TBD |
Tracking Bug(s) | bug 604700 |
Documentation: | Draft Proposal |
Project Details
Summary
The purpose of this project is to ensure all tests are implemented using an agreed style guideline. The workflow of this project will mostly be parallel with the Shared Modules Refactor project. This project will be rolled out in multiple phases.
Phase I
Goal: Refactor "lowest-hanging-fruit" changes
Dependencies: Agreed upon style guidelines
Refactoring
- Timeouts & Delays
- gDelay: replace with a discrete int value
- gTimeout: replace with TIMEOUT
- Constants
- const SOME_CONST = value;
- setupModule & teardownModule
- Remove module parameter
- Mozilla Components
- Ensure proper alignment of getService() on Cc[]
- Local Test Pages
- Replace any LOCAL_PAGE or LOCAL_TEST_PAGE with a LOCAL_TEST_PAGES array
- Each array element should have at least a URL and ID member
- Arrays
- Ensure proper alignment from style guidelines
- Assertions
- waitForEval: replace with waitFor()
Style Guidelines
- Timeouts & Delays
- Proposed Guidelines:
- Delay: Use discrete value
- Timeout: Use global TIMEOUT
- Henrik: Timeouts should be encapsulated within a global shared module
- Geo: Use default params where appropriate, wrapper functions where not
- Constants
- Proposed Guidelines:
- Exist between requires and setupModule()
- const SOME_CONSTANT = value;
- Geo: All unchanging variables as constants
- Function Signatures
- Proposed Guidelines:
- var nameOfFunction = function() {
- Geo: Agree on open-brace on same line but common in JS to have an next-line exception for named functions; could go either way.
- module as a param for setupModule & teardownModule
- Proposed Guidelines:
- ???
- Geo: Strange to have a function not declare a parameter that’s actually being supplied, but maybe that’s more normal in JS.
- Henrik: Removing module was probably a mistake; used for injecting global functions into the module scope.
- Mozilla Components
- Proposed Guidelines:
- var obj = Cc[“@mozilla.org/component;1”].getService(Ci.interface);
- Declare in setupModule()
- For word-wrapping, split after the ., getService() aligned with Cc[]
- LOCAL_TEST_PAGES
- Proposed Guidelines:
- Encapsulate all local test pages within a const LOCAL_TEST_PAGES array
- Each element (test page) consists of a URL and an ID
- Henrik: We should use Name, Link, and XPath as well
- Aaron: Establish a module/API to handle loading of any needed test files
- Array Formatting
- Proposed Guidelines:
- Each array element on its own line
- Each element member on its own line
const LOCAL_TEST_PAGES = [ { id: “Some_ID”, url: LOCAL_TEST_FOLDER + ‘someFolder/someFile.html’ }, { id: “Some_ID”, url: LOCAL_TEST_FOLDER + ‘someFolder/someFile.html’ }, { id: “Some_ID”, url: LOCAL_TEST_FOLDER + ‘someFolder/someFile.html’ } ];
- Assertions
- Proposed Guildeline:
- All wait-for-assertion cases should use the waitFor() function
- Use the following formatting:
controller.waitFor(function() { return someObject.value == expectedValue; }, TIMEOUT, 100, “My failure message”);