Log the information in VS to see it in VSE log?
search cancel

Log the information in VS to see it in VSE log?

book

Article ID: 112450

calendar_today

Updated On:

Products

CA Application Test CA Continuous Application Insight (PathFinder) Service Virtualization

Issue/Introduction

Sometimes, we need to find out some information from the VS which we can't see it in inspection view. This article will provide information on how to log the details in VS to see it in VSE log?

Environment

Al supported DevTest environments.

Cause

None

Resolution

To log the information in the VSE logs, add the code in a scripted assertion in the VSM steps. For example, see the below code
------- 
_logger.info(" Service = {}, Step = {} And Data is: {}", 
"My Virtual Service Name Here", 
testExec.getStateValue( "LISA_LAST_STEP" ), 
testExec.getStateValue("accountNumber") ); 
// log additional values here 
_logger.info(" Getting List of Virtual Services"); 
return true;
----

VSE log will show information like below based on the above code
----
Service = {"My Virtual Service Name Here"}, Step = {the value of "testExec.getStateValue( "LISA_LAST_STEP" );" } And Data is: {the value of "testExec.getStateValue("accountNumber") ); "}"
Getting List of Virtual Services
---

Note: You can always "return true;" in the code and do the assertion logic as "If False to Fail" (which will  never happen.