VMware Cloud Community
xian_
Expert
Expert

Form test - automation

I'm looking for a way to validate our custom forms and xaas forms. I can start a deployment via API but this does not validate our inputs, dropdowns etc.

Anyone with experience on this? I hope I do not have to use some generic webpage testing tool.

Versions we're interested in are: v7 and v8

Reply
0 Kudos
5 Replies
kumarsenthild
Enthusiast
Enthusiast

Hi Mate,

I had similar requirements in one of the project. 

Below tips I tested only on vRA 7.x

For Custom form ( I believe IaaS blueprint) use Subscription method (EBS)  with Requested stage, this will call vRO wotkflow and take all inputs from payload , perform inputs validate

Refer life cycle extensibilities stages

Machine Life Cycle Extensibility

For XaaS blueprint,  very simple create a one task to validate the inputs.

Let me know if you need more details

Regards Senthil Kumar D
Reply
0 Kudos
xian_
Expert
Expert

I've already implemented those.

I want to validate if the custom logic works on the form itself.

For example user can select a datacenter from a drop-down. I want to validate the options exist and correct. Then the user can select a network based on his first selection of datacenter. I want to validate if the correct networks are listed, related to the datacenter.

Reply
0 Kudos
kumarsenthild
Enthusiast
Enthusiast

Please keep in mind teo things

1, we can't validate user inputs, before REST APi request

2, custom form or XaaS form dynamic data population will not work REST API.

May be try this one

Create a vRO workflow with all user inputs, only for REST API calls.

Task 1 : validate all user inputs with your business logic ( based on application,  location , datacenter, OS ) [ throw error, if required send an email ]

Task 2: request vRA catalog item with user inputs

In above process,  you we will not see any error if vRA portal incase user missed in the data. It will failed in test 1 itself

Regards Senthil Kumar D
Reply
0 Kudos
eoinbyrne
Expert
Expert

Have you looked at web test tools like Selenium? Since the custom and XaaS forms are just webpages you should be able to have Selenium walk the form and validate drop-down relationships etc.

I'd also add that for my XaaS forms where I use a vRO action to handle constraints etc I'd observe that these relationships can be viewed as "chains" where the changing a value should cause the chain re-compute. So, I use a workflow to drive values at the chains - sort of of like unit testing where I have to handle chain order execution, validation of expected results etc.

Anyway, HTH

Reply
0 Kudos
xian_
Expert
Expert

I took a look on Selenium IDE (the browser plugin that can be tried quickly) but I did not see the dropdown validations. This is what I wanted to avoid, to use such generic tools.

I checked the vRA GUI with Chrome Developer tools and found some promising API calls while clicking around in my blueprints. For XaaS this is what the form itself uses (in v7):

https://vra.corp.local/catalog-service/api/consumer/catalogItems/859fcd98-90ec-4764-b906-58f7dea9180...'

and POST data looks like:

{"headers":{"entries":[]}, "formValues":{"entries":[{"key":"requestedFor", "value":{"type":"string", "value":"user1@corp.local"}},{"key":"description", "value":{"type":"string", "value":"My Blueprint"}},{"key":"provider-datacenter"},{"key":"provider-network"}]}, "affectedElements":["provider-__ASD_PRESENTATION_INSTANCE","provider-datacenter","provider-network"]}'

The response is similar to:

throw 1; < don't be evil' >{"https://@com.vmware.csp.core.cafe.catalog.api.vproxy.vproxy/consumer/catalogItems/859fcd98-90ec-4764...":{"rc":200,"body":"{\"elementUpdates\":[{\"id\":\"provider-__ASD_PRESENTATION_INSTANCE\",\"detailLayout\":null,\"facetValues\":{\"facets\":[{\"type\":\"visibility\",\"value\":{\"type\":\"boolean\",\"value\":false}},{\"type\":\"fixedValue\",\"value\":{\"type\":\"string\",\"value\":\"806a5979-8077-4e13-9ab2-fdad11a147ec\"}} ... {\"type\":\"string\",\"value\":\"network1\"} ...

This response lists the available options too, so could be validated and looks like the form update changes the response just like in the GUI. So this can be automated but not very easy to make the test data and evaluate the result.

Wrt. Custom Forms, it is even more complicated, communicating with Forms API (formsprovider, externalvalues, ...) in multiple steps.

But in general, this looks feasible but not easy to implement.

Reply
0 Kudos