Oracle APEX 5.1, ATAF and automated testing
ATAF - Why not giving it a chance?
Step 1. Configuration and installation – hands on experience
Back to everyday work with some spare time to try out what I picked up from this year’s KScope17.
Among many great sessions I taken with me, one that I decided to try out now is ATAF – APEX test automation framework.
Writing and maintenance of testing scripts is
something none of us like doing but it is something that can safe heaps of time
later in the project. I am hoping that we do not have to go into why you want
to automate your testing and all the benefits it brings.
From my developers perspective, having to deal with
maintenance of scripts that I created in Selenium wasn’t most exciting thing
but over time it has proven to be a challenge and was taking way too much of my
project time. This is why I got excited about Simon’s project and ATAF. If it
could reduce the time needed just from maintenance perspective I think we have
something good in our hands.
After spending roughly a week with ATAF I decided
to write down initial thoughts and how it all went.
Please note this is my personal view about ATAF and
your experience might be slightly different. Any ‘negative’ comment (if any :) ) is only
meant to be a constructive criticism to help make this a better tool for all of
us.
Download
and documentation
Good thing is that Simon and the team made an effort
to make it publicly available on Github https://github.com/schunt1/ATAF
After you get the source there is a Documentation
folder giving you all necessary information about how it works and how to
install ATAF.
Installation
As per documentation there is an option for you to
install ATAF in your existing scheme or installing it on its own.
I decided to install it in its separate schema as I
have too many workspaces I need this for so wanted to reduce multiple
installations.
Basically it consisted of creating a new DB schema with create view grant,
new workspace and running install.sql script. Installation was pretty easy and
it did require a recompilation of all objects as per documentation. Installation
script did need a "/" at the end otherwise it just hang in my SQL session.
Configuration
Again following the documentation there was not
much to do here. There were some additional view changes to support running from
separate schema.
Only addition was that ATAF schema required grant
execute on DBMS_LOCK package.
First run
After ATAF application was imported into my workspace,
this is where things started to go slightly off the rails. Do not get me wrong,
nothing that you will not able to fix but it did need some additional
interventions.
Basically things were hooked up to hardcoded theme number
42 which is a default value for all default testing data. In my case I was
using custom build theme with ID 40000 so had to make some changes to original scripts. I am
expecting that most people with Universal theme (42) would not have to do the
same.
Changes and comments
Application pages I had to change:
Page 1 – fetch returns multiple rows error
Page 2 – Select LOV invalid
Page 3 – Actions did not see my Interactive Grid JS
buttons
Page 18 – LOV needed a change
Files updated to fix above issues:
ataf_apex_applications_v
ataf_apex_page_items
ataf_apex_page_items_v
ataf_apex_pages_v
ataf_apex_shortcuts_v
ataf_apex_themes_v
ataf_test_condition_full_v
ataf_test_condition_v
ATAF_PKB
ataf_selenium_for_custom_theme
To align with my domain needed to do this update
update
ataf_selenium
set
target = replace(target, 'ords', 'apex/lbs')
where
theme_number = '40000'
and target like '%/apex/%';
As you can see it wasn’t all smooth sailing but now
that I am actually able to run ATAF I am pleasantly surprised.
I was able to
create my dummy testing scripts which ran perfectly fine in Selenium after just
2 days of work which is pretty good in my eyes without having to know a single
line of ‘Selenium scripting’.
Challenges and still to
come
Since I am still in early days learning ATAF and
all of its features it did take me a while to get running. I also think that
initially there will be a learning curve for all to grasp how it all works.
After a day or so of using ATAF I was able to add test
data and framework made it easy to loop through my test-cases which nice to see.
Selecting menus, buttons and entering page items
was not a problem.
If I can point anything as challenging, I am still
learning how is it best to create new actions that will do custom validations
in my 5.1 apps.
Also it will be interesting to see how I will
survive with my xpath selector knowledge as I am more used to class selectors.
But hey feeling about ATAF is positive and I think
this is all that matters.
To summarize, hope more of us will give ATAF a go
and would love to see what others make of it.
In next couple of days I will try my best to
dedicate more time figuring out some new things in ATAF and putting it all
together for Part 2 of this post.
Happy Apexing,
SLino