You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cloudstack.apache.org by "Sowmya Krishnan (JIRA)" <ji...@apache.org> on 2013/10/28 07:26:30 UTC

[jira] [Created] (CLOUDSTACK-4972) [Automation] Utility function to care of Errors due to possible empty list assignments

Sowmya Krishnan created CLOUDSTACK-4972:
-------------------------------------------

             Summary: [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#6144)