ATF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2019 01:28 AM
How to create ATF test in servicenow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2019 01:35 AM
adding few blogs link, please refer that. hope it will help you.
Automated Test Framework Part 1: First Impression
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2019 02:29 AM
Create ATF test to implement below steps:
Verify below pages on mobile url (https://xxxx.service-now.com/$m.do#/home):
1. Favorites
2. Field Service
3. Home Page
Note: If suitable steps are not found in ATF, need to be created using step "Run Server side script"
Can you please guide me how to this with proper screen shots
Im new to ATF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2019 01:37 AM
Hi,
You can refer below url:
https://docs.servicenow.com/bundle/london-application-development/page/administer/auto-test-framework/task/atf-enable-tests.html
Mark it correct or helpful, If it helps you.
Thanks,
Snehal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2019 03:25 AM
Hi Nag,
I found a way to verify your requirement - taking an example for Homepages in mobile view. You can use this as sample case and solve your all requirements. I have only used True or Success Case here, you can define failure cases as well.
For Assertion (which is used for checking the expected and actual values) you can use this function:
var testAssertion = {
name: "my test assertion",
shouldbe: "expected value"
value: "actual value",
};
assertEqual(testAssertion);
You can follow these screenshots for a quick view, code snippet is also provided for easy reference.
1. Test in ATF
2. Test Step - Run Server Side Script
3. Code snippet
(function(outputs, steps, stepResult, assertEqual) {
// add test script here
var list = ['My Incidents','Knowledge','Location','My Requests','Service Catalog','My Approvals','Favorite KPIs','Connect'];
var gr2 = new GlideRecord('sys_ui_mobile_home_page_section');
gr2.query();
while (gr2.next()){
var gr = new GlideRecord('sys_ui_mobile_home_page_module');
gr.query();
while (gr.next()){
stepResult.setOutputMessage("The module found in Homepage is"+gr.title);
gs.log('Found 1 module'+gr.title);
for (i=0;i++;i<(list.length)-1){
assertEqual({name: "Checking Module Name", shouldbe: list[i], value: gr.isValidRecord()});
}}// pass the step
return true;
}
})(outputs, steps, stepResult, assertEqual);
// uncomment the next line to execute this script as a jasmine test
//jasmine.getEnv().execute();
Output:
Thank you. If you find this answer as helpful or correct, please mark it so!
Regards, Akash
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.