eagleman
Giga Contributor

Many of us have the problem to automate the change process due to the Risk Assessment.
In the process you have to press the "Fill Out Risk Assessment" and "Execute Risk Calculation" UI actions for risk assessment in order to proceed with the test.

As far as I know, is not possible to interact with the popup of the questionnaire and to press it's submit button via the ATF available steps. I found some workarounds in the community (like changing the risk value by server side script) but i wanted the test to be complete and to test also the risk calculation based on the type of answers to the questionnaire and their weight.

First I looked at the record structure of a completed survey to understand needed tables, fields  and relations. I noticed that the Instance is named with the "DateTime" of when the Submit of the survey was pressed, and is the same in all DateTime fileds in the records:

find_real_file.png

  1. The "Risk Assessment" is the record that the system looks at in first place. It's containing reference to the the change and to the instance which is the link to the question results
    find_real_file.png
    1. Filed "Assessment" - select "Change Risk Assessment" (or how is nominated the survey)
    2. Field "Task" - Is the Change number
    3. Field "Completed By" - The user that took the survey
    4. Field "Completed Date" - The DateTime when the survey is inserted
    5. Filed "Instance" - The Instance of the survey. It's name is exactly the DateTime above

  2. The "Responses" are the records of each question, asnwer and answer weight and they are also related to the instance.
    find_real_file.png
    1. Filed "Instance" - The Instance of the survey.
    2. Field "Question" - The Survey Question
    3. Field "Response" - The response to the specific question
    4. Field "Answer Integer" - The value of the specific response

  3. The "Instance" is the link between these records. 
    find_real_file.png
    1. Field "Taken On" - The DateTime as all above and also the name of the record
    2. Field "Survey" - The survey selected
    3. Field "Taken By" - the User that took the survey

So i decided to go this way, create a test case with this steps and it works:

  1. Impersonate a user
  2. Insert a change
    • table: change_request
  3. Insert a record for the Survey Instance (choosing a DateTime and using it wherever needed in all records)
    • table: survey_instance
  4. Insert a record for each Survey Question's Answer (we have 6 of them, i'll put only one in the screenshots)
    • table: survey_response
  5. Insert a record for the Risk Assessment
    • table: task_assessment
  6. Open the Change form
  7. Press the "Execute Risk Calculation" UI Action

find_real_file.png
find_real_file.png

Of course then i put those steps in a full End to End test case for the change process.
I think this is the best way, so far, to be able to complete a change test including also the risk assessment calculation (selecting different  answers in different tests or re performing them in the same test) .

If anyone finds out a way to interact with the Risk Assessment popup please get in contact and tell me because it would of course be better and more simple.

Comments
Sean98
Mega Contributor

thanks for doing the analysis! I will give this a go! šŸ™‚

Sean98
Mega Contributor

In my London instance, we don't have a 'Execute Risk Calculation' UI button...I'm assuming this is needed to be able to complete the Risk Assessment bypass...

Gedske
Kilo Contributor

Hi and thank you for your solution. I'm trying to make it work, but like Sean a while ago, I have the issue of no 'Execute Risk Calculation' button in Madrid. Have you developed this workaround further since a year ago or do you have an idea on how to make the test calculate risk and set it in the Change Request?
Your answer will be much appreciated!

jus_doggin
Tera Contributor

We used this method for Change Survey prior to upgrading to Madrid, but updated to use Custom UI steps in Madrid. The issue with doing it all back end was that it didn't exercise the code used in the UI related to survey scoring, which we customized.  Using Custom UI allows us to no longer need to "simulate" completing the risk survey, but instead it uses the actual UI.  Our survey has 12 questions.

In conjunction with this we use paramaterized tests and are able to call both via a master test that acts as a modular data generator for all Standard Change tests.

Lee Ring1
Kilo Explorer

Hi jus,

Trying to follow this approach as well, but getting an error, "Cannot read property 'ownerDocument' of null" on the "Set Component Values (Custom UI)" step execution. Did you have this issue?

Thanks

Lee Ring1
Kilo Explorer

Issue was resolved by rerunning the Retrieve Components action and capturing a fresh "mug_shot".

sai195
Tera Contributor

Hi Lee,

We're facing the same error. can you please help me how to resolve in detail?

Thanks in Advance!!

Lee Ring1
Kilo Explorer

I wish I could be more specific. I only know that the error stopped after I reran the "Retrieve Components" operation and then re selected the Component values that I wanted to set.

NOTE: In its current state this method of processing an Assessment is still just "adequate". While it does seem to create the required records once the "Submit" button is clicked, I am not able to predict the precise behavior of the assessment. There is still MUCH room for improvement in the Custom UI Step Configurations. I have not reviewed Orlando on this topic yet.

 

Cheers,

Lee

Mohini4
Kilo Contributor

@Lee Ring  - I am stuck with the same error and even I tried using the retrieve components one more time but still throws the same error as "Step execution failed with error: Unable to get property 'ownerDocument' of undefined or null reference "

 I thought may be its a time out issue - so gave 25 s timeout too but still failing

Any other idea or suggestion - my pop up window has 9 questions

Lee Ring1
Kilo Explorer

Sorry to say that I haven't learned anything new about this ATF Test Step. I recommend opening a case with HI Support on this behavior. They will need to work toward improving the behavior of ATF Steps involving surveys.

 

Rashmi C
Kilo Explorer

Hi , 

 

I had the same issue in calculating the risk , Hence I used the below server side script to set the risk.

var gr = new GlideRecord("change_request");
gr.setValue("short_description", "test");
gr.setValue("description", "test");
gr.setValue("risk", "1");
outputs.record_id = gr.insert();

 

risk-1 is critical, risk-2 is high and so on.

 

Thanks,

Rashmi

 

Version history
Last update:
ā€Ž08-31-2018 01:50 AM
Updated by: