TestWise: “Run selected steps against the current browser”
An essential test-developing/debugging feature for wise test automation engineers.
Zhimin: I suggested one topic for her writing this week, “What is the most important reason that you exhibited significantly higher productivity than the ‘best senior test automation engineer’ in her first internal role at a large telecom firm?”. Also, I added, “Take into consideration the perspectives of both beginners and experienced test automation engineers”. This article was her answer.
In my First Day Setup series, I mentioned that my favourite feature of TestWise (a functional testing IDE) is running selected steps against the current browser. It enables you to run any test steps on a currently open browser and is extremely helpful for writing and debugging tests.
This article is dedicated to when and how to use this helpful feature.
Table of Contents:
· Before Using this Feature
· Using “Run Selected Scripts Against Current Browser”
∘ When to Use this Feature?
Before Using this Feature
To use this feature, first, run a test (it could even be a blank test!) and make sure the browser window stays open. If the window closes, you won’t be able to reuse that browser for this function. Check out my dad’s article, Keep the Browser Open after Executing an Individual Test.
In TestWise, keep your window open by not running driver.quit
in the after(:all)
hook function.
One way to do this is to comment this line out. However, remember to uncomment it later!
after(:all) do
# driver.quit
end
Another (recommended) approach is to set the browser to quit only when debugging. This is the default setting in a new TestWise spec file.
after(:all) do
driver.quit unless debugging?
end
Debugging mode is when you run a single test case (not the whole file). This is the icon with the run arrow and boxes (as shown below). The shortcut for this on Mac is Shift + Command + F10.
Using “Run Selected Scripts Against Current Browser”
Now that you have a browser session open, we can continue using this browser to run specific lines of your choice.
Select the lines you want to run and select the “Run Selected Scripts Against Current Browser” option (or Option + F11).
You should see the lines execute in the browser.
Please note that the execution is from a special test script file, debugging_spec.rb
(auto-created by TestWise). The use_current_browser
step will ‘attach’ to the current existing browser.
Then, you can execute the test steps (in this particular test file) and see the result immediately in the browser. You are free to edit (change/add/remove) the test steps.
Keep in mind that:
Only uses the most recent open browser for execution.
If you run two or more tests (2+ browsers open), this mode will only use the last executed test’s browser. If it gets closed, you must rerun a test case to open another browser before activating this mode.You can manually use the browser as freely as you want.
There is no ‘lock’ (by TestWise) on the browser. You can manually click buttons/links and even change websites. And the attached script execution will pick up where you left off.
Zhimin’s notes: this means great flexiblity. I will show an extreme example, suppose you want to do a live showcase against a production site, but captcha or two-factor authentication prevented automation.
You can do this:
1. Run an empty test script in TestWise to active this debugging mode
2. Pass captcha or two-factor authentication manually
3. Run prepared test steps in debugging mode, on this browser window.
When to Use this Feature
This feature is most useful when developing and debugging an individual test case.
Keep reading with a 7-day free trial
Subscribe to The Agile Way to keep reading this post and get 7 days of free access to the full post archives.