[
https://issues.apache.org/jira/browse/CLOUDSTACK-4972?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Girish Shilamkar resolved CLOUDSTACK-4972.
------------------------------------------
Resolution: Fixed
We have added a function VerifyElementList function for this.
> [Automation] Utility function to care of Errors due to possible empty list
> assignments
> --------------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-4972
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-4972
> Project: CloudStack
> Issue Type: Test
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Components: Automation, marvin
> Affects Versions: 4.2.0
> Environment: Marvin, Test scripts
> Reporter: Sowmya Krishnan
>
> Presently with Test scripts written using Marvin, most tests don't have to
> perform an explicit check each time there's a list API call followed by an
> assignment of the first object of the list to a variable. There is no check
> presently done to find out if the list returns an empty result either.
> Tracking bug to create a utility function to take care of possible empty list
> assignment and throw appropriate error if this happens.
> Example code
> networks = Network.list(
> self.apiclient,
> id=network.id,
> listall=True
> )
> self.assertEqual(
> isinstance(networks, list),
> True,
> "List networks should return a valid response"
> )
> nw = networks[0]
> An empty list assignment would probably just throw an exception and debugging
> is difficult when lot of tests are being run.
> Comments on better ways to handle this are welcome.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)