With the number of test scripts growing, so is the total execution time. The nature of the automated UI tests, error prone of application changes, means that the test maintenance engineers need extreme high efficiency to address unknown test failures from test runs. Unfortunately, very few people know about that. This explains why many projects started test automation attempts with high hope, and failed quietly soon after. The reason: they underestimated the maintenance effort and engineers are lack of efficiency to cope with it.
TestWise was designed with high productivity in mind. You have seen the features earlier such as “Quick Navigation” and “Various Test Execution mode”. From this chapter, we will focus some features that will make your automated testing experience better. The Following two chapters focus on two important categories of test automation practices: Refactoring and Debugging, which can be regarded as productivity-enhancement features.
- Validate Script
- Reformat test scripts
- Run one test against different environments
- Editor features
- Todo List
TestWise supports syntax validation for the following type of test scripts (or documents):
Click the icon on the toolbar,
If there are syntax errors, a pop up will show the error.
Warning: Sometimes the error line number shown is not where the syntax error actually is, as an error on previous lines may be only detected on later ones.
A warning icon will be shown on the status bar as well. Double click the warning icon will show the error message in a popup window.
There won’t be warning messages (or indicator on the status bar) if the syntax is OK.
Note: Before a test is executed, TestWise will try to save the script file and validate the script syntax (by default).
Reformat (or sometimes called pretty printing) test scripts to make them indent correctly, i.e., more readable. Test scripts that are indented correctly and consistently are easier to spot potential errors.
To reformat a test script file when it is opened in an editor, click the icon on the toolbar to reformat. Here is ‘before’
and here is ‘after’ the reformatting applied.
It is a widely adopted practice to set up several environments, namely “Development”, “Test”, “Integration”, “UAT”, and “Production”. You may want to run one test against the different environments as requested. TestWise makes it easy to do so without any changes to your test scripts or server configurations.
Select from the menu Tools → Project Preferences (or
Ctrl + Alt + ,) and click ‘Environments’ tab.
Then select which environment (on the toolbar) you like to run tests against.
The environment selected is also showed on the status bar.
How does it work? In test script (if following TestWise convention), here is test statement navigates to the home page of the test server.
site_url function is defined in
test_helper.rb, which load an environment variable
BASE_URL set by TestWise at run time.
def site_url(default = $BASE_URL) ENV["BASE_URL"] || default end
Snippets in TestWise IDE are little bits of texts (abbrev.) that expand to full test script statements. For example, type
dfei (in RSpec mode) followed by will expand to
username and press , you will get
Beside the features that are commonly found in programming editors, TestWise provides ones that help testers to script efficiently.
Select quoted string
Testers need to frequently do copy-n-paste the texts from web pages. Selecting the whole text in matching quotes (keyboard shortcut:
Ctrl + I) can save time.
Select all lines in a scope
Quickly select all texts in a scope such as a test case (as the example below) or a function, using keyboard shortcut
Ctrl + Shift + C.
Quick comment/uncomment scripts
Ctrl + / to comment out the current line, regardless of position of the caret, as long as it is in the line. If the line is already commented,
Ctrl + / will uncomment it.
After the comment/uncomment operation, TestWise will move the caret to the next line.
Select multiple lines, presse
Ctrl + D to duplicate the text. If no selection, the current line will be duplicated. Comparing to
Ctrl + C and
Ctrl + V, the benefit of it is that you can keep the text in the clipboard.
Quickly enter the words already in the document. For example, in this test script file.
@driver = $browser = Selenium::WebDriver.for(browser_type, browser_options) # ...
If you type
browser (in any other part of this document) and press ‘Esc’ keys, the text will cycle through →
Auto-complete framework functions (experimental)
TestWise has built-in support for the standard frameworks such as Selenium WebDriver. If the test scripts follow the common naming convention, the limited auto-complete framework functions is available.
For example, after typing
A helper is used to look up framework syntax for certain operations. There is an example below: “search for the selenium syntax of selecting an option in a dropdown”.
TODO List items are special comments in project files that are marked to future attention, such as TODO, CHANGED, NOTE and FIXME, examples below:
# TODO Add a test case for 'Remember me' checkbox # CHANGED by zhimin: now using page objects # FIXME duplications here # NOTE term 'oneway' is going to be changed in next release
Click the icon (as indicated below) on the left navigation bar to access it.
You can click an individual item to quickly navigate to it.