Service Virtualization

Expand all | Collapse all

Filtered values are not displayed in "available objects" section in CA dev test

Jump to Best Answer
  • 1.  Filtered values are not displayed in "available objects" section in CA dev test

    Posted 02-07-2018 07:21 AM
      |   view attached

    I created a test case which executes a web service. In the response xml, I used filters and stored 2 of the response values (see attached screen shot) so that I can use these values from "available objects" section during scripted assertion. Then I closed this test case and opened again. When I navigated to filter section, I see the previously filtered values are not highlighted in yellow colour. When I hit "run filter" button, I get blank. So how can I use the response values in my "scripted assertion" section. Please help me with this. How to store these values in object.

    Attachment(s)



  • 2.  Re: Filtered values are not displayed in "available objects" section in CA dev test
    Best Answer

    Posted 02-07-2018 08:56 PM

    In the Scripted Assertion, retrieve the value using:

    String status = testExec.getStateValue("LWIFI_create_activityStatusEnum");

     

    Or, you can use this as a safety net in case the variable is not initialized:

    String status = testExec.getStateString("LWIFI_create_activityStatusEnum", "" );

     

    The assertion can then check the 'status' variable based on requirements. For example,

    // trap for getStateValue in case property uninitialized

    If ( status == null )   

       return false;

     

    // trap for getStateString in case property uninitialized

    // technically this is unnecessary; however, here for example

    If ( "".equals( status ) ) 

       return false;

     

    if ( "SUCCESS".equals( status ) )

       return true;

    else 

       return false;

    In the above, the assertion branches to Error, Warning, etc. if the response is false. If the assertion returns true, the test case moves to the next step in the flow.

    Alternative:

    if ( testExec.getStateValue("LWIFI_create_activityStatusEnum") == null )

    :

    if ( "SUCCESS".equals( testExec.getStateValue("LWIFI_create_activityStatusEnum")  ) )

    and / or 

    if ( "".equals( testExec.getStateValue("LWIFI_create_activityStatusEnum")  ) )



  • 3.  Re: Filtered values are not displayed in "available objects" section in CA dev test

    Posted 02-08-2018 09:10 AM
      |   view attached

    Thanks alot. I have created a test case and it got passed. I also used the below code section to get the message

     

    testExec.setStateValue("fl_msg", msg);

     

    But I am able to see the value of "msg" in "fl_msg" in available objects section only if that test case (with that scripted assertion) is already opened in a tab. If I run the suite with the test case closed, I am not able to see this object when I open the test case. Is there any way to store these variables in a file? Is there any place where I can see the consolidated report for the test cases which I run to know how many got passed and how many got failed? Please help me with this.I have attached the screen shots.

    Attachment(s)



  • 4.  Re: Filtered values are not displayed in "available objects" section in CA dev test

    Posted 02-08-2018 09:25 AM

    I think you are trying to open a test case asset and see a value that is not technically available until runtime. 

    Just because a step creates a property and stores a value does not mean the value of the property is displayed when a step is opened in Workstation.

    There is a concept of saving some of the test state.

    If you want to save a property to the file system, you can use a Utility Filter - but this will only save the value when the test case is running not when it is opened.



  • 5.  Re: Filtered values are not displayed in "available objects" section in CA dev test

    Posted 02-15-2018 06:47 AM
      |   view attached

    I selected "save Property Value to File". But I dont see an option where I can write the values which are in available objects. As my test case pass/fail I m adding the below line in my script

     

    testExec.setStateValue("fl_msg", msg);

     

    The above value "fl_msg"" is getting stored in available objects. But when I use the above utility "save property value to file", I dont see an option to save the value from my script. Please see my attached screen shot..

    Attachment(s)



  • 6.  Re: Filtered values are not displayed in "available objects" section in CA dev test

    Posted 02-20-2018 05:56 PM

    Ah, yes, the drop down list is populated based on last fields used not properties that have been created.

    Using the keyboard, highlight and replace lisa.Web Service.rsp with fl_msg.  This change will cause the value of fl_msg to be saved.  By default, this step assumes that the utility is saving the "last response". 



  • 7.  Re: Filtered values are not displayed in "available objects" section in CA dev test

    Posted 03-02-2018 08:49 AM
      |   view attached

    Hi ,

     

    I tried the same. When I open the test case and then manually run the rest step and then the scripted assertion ad then run the utility filter, I am able to see my "success" message from "f1_msg" in the file where I saved.But when I run the whole test case by clicking "run locally" from the suite, I dont see any values saved in that file. Please see my screen shot attached method 1 and method 2.Please advise

    Attachment(s)

    doc
    method 1 and 2.doc   980K 1 version


  • 8.  Re: Filtered values are not displayed in "available objects" section in CA dev test

    Posted 03-02-2018 09:34 AM

    In the Save Property to File Location filter. Is the directory / path displaying as c:\ca\devtest\projects\AutomationForSprint4 or is it displaying as {{LISA_RELATIVE_PROJ_ROOT}}/test saved value.txt? My suspicion is the filter is using the latter construct.

      

    As a test, override {{LISA_RELATIVE_PROJ_ROOT}} with the actual file path and run the Suite locally. I am hopeful that the output from the Suite will create the file. I believe Suites take on some slightly different characteristics where the Suite, when using {{LISA_RELATIVE_PROJ_ROOT}} creates output into a transient location in c:/users/<user>/lisatmp_x.x.x. The reasoning may be that Suites eventually run under the Coordinator/Simulator where the relative project root might not actually exist on the file system. 



  • 9.  Re: Filtered values are not displayed in "available objects" section in CA dev test

    Posted 03-05-2018 06:02 AM

    Yes it is displayed with {{LISA_RELATIVE_PROJ_ROOT}}. But I am not able to override. When I do, "{{LISA_RELATIVE_PROJ_ROOT}}" is automatically populated.



  • 10.  Re: Filtered values are not displayed in "available objects" section in CA dev test

    Posted 03-05-2018 08:31 AM

    As a test, can you override output path to something like, c:\temp\AutomationForSprint4 My main interest is to see if the test places the file somewhere other than the projects directory. It is probably best to open a ticket so one of the support team can look at this in a webex.



  • 11.  Re: Filtered values are not displayed in "available objects" section in CA dev test

    Posted 03-05-2018 09:29 AM

    I also tried with some other path (my local drive). The value is not saved in that text file too.