Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
SAP Conversational AI develops a natural language processing (NLP) technology which can be utilized by the customers to automate repetitive services for their clients and provide 24/7 availability.

This technology delivers Bots which can be integrated to different user interaction environments. This can be a customer specific web-based solution or popular solutions like Facebook or Alexa. These Bots do understand text communication as well as speech.

Such a Bot has been already integrated to SAP SuccessFactors as the Digital Assistant solution. The Bots mission in any environment is always to manage the conversation with the user and to provide the requested service which in a simple case could be to just serve as a FAQ agent.

These Bot solutions need to be trained, customized and integrated into customers IT environment. Like any other software the implementation methodology for SAP Conversational AI solutions will require testing activities. Usually this starts with unit testing, technical and integration testing till user acceptance testing. Once a Bot solution is operational it will face change events like any other software. This implies the need for regression testing and the library of regression test cases is always a strong candidate for automation.

SAP Conversational AI technology is not based on any SAP standard UI. It is not based on SAP GUI, Web Dynpro or UI5. In early 2018 SAP did acquire the French based company Recast-AI. Their NLP solution is the core of SAP Conversational AI. Therefore, automation tools like the Component Based Test Automation (CBTA) in SAP Solution Manager are not the first choice for an automation engineer.

The first choice is any automation tool which is certified by SAP to integrate with the Test Automation Framework in SAP Solution Manager like Micro Focus UFT. – The question to be answered is if Micro Focus UFT capabilities are sufficient to automate SAP Conversational AI Web Chat Bots.

All the following observations and results have been obtained by using Micro Focus UFT version 14.50.

The standard Web-Add-In was selected to check the record and replay capabilities. It turned out that the best results could be obtained by using Microsoft Internet Explorer. The recorded steps have not been sufficient to run the scripts successfully. Using the object spy in UFT on web elements which have been not identified by the recorder did not help as the object spy did only identify the object hierarchy until the Page object which was not sufficient.

The solution once again is to use descriptive programming together with the development tools of the browser. Descriptive programming provides the automation engineer full control on his script. The required object properties can be identified by using the inspection tools of the browsers. The development tools can be enabled by the key F12 for Microsoft Internet Explorer as well as Google Chrome.


Image: Google Chrome Inspection Tool (F12)


It turns out that the class property of the web elements is a very good identification property. Only in case there are more than one of such objects on the page additional properties are required.

The most important web element is the text area where the user can enter and send his message to the bot. This area is of class RecastAppInput. Unfortunately, a WebEdit object with this class property is not identified. A WebElement object in turn is recognized. But to set a text and to submit it some further “tricks” are required.

 


Image: Google Chrome Inspection result


 

The main object to navigate is objWeb as defined here:

Set objWeb = Browser("CreationTime:=1").Page("Index:=0")


It is defined to shorten the hierarchy length in every statement. You could then set the value with:

objWeb.WebElement("class:=RecastAppInput").Object.innertext = “Hello Bot!” 


And use the SendKeys method of a WScript.Shell object to send an ENTER.

It turns out that it is more stable if you just use the WebEdit object identified by the index property. E.g.:

objWeb.WebEdit("Index:=2").Set "Hello Bot!"
objWeb.WebEdit("Index:=2").Submit


The Web Chat Bot has now some options in which style to reply. This can be either just a text message or some text and images providing the user a set of predefined buttons to select.

 


Image: Web Chat Bot for a movie database solution


The buttons can be identified as WebElement objects with the primary identification property class. As we only have to perform a click operation a statement like this works fine:

objWeb.WebElement("class:=slick-slide slick-active slick-current RecastAppQuickReplies--button""outertext:=Action").Click


During a conversation with the Bot you will have to add some checkpoints into your script. In order to accomplish this, it is good to know that you can obtain the complete conversation as a string on which you can then perform some string pattern operations to verify if the actual conversation meets the expectations.

The following statement will provide you the complete conversation in a string:

strChat = objWeb.WebElement("class:=RecastAppLive.*""Index:=0").GetROProperty("outertext")


In summary we are able to create a script with Micro Focus UFT using descriptive programming to automate a conversation with a SAP Conversational AI Web Chat Bot. We can send text messages to the Bot. We can interact with buttons provided by the Bot and we can obtain the complete conversation as a string to implement checkpoints.