I have been working on running test cases with EuTester by following some of the wiki posts by my fellow classmates as well as blog posts located here by Vic Iglesias. There is still a bit of a learning curve working with python as a language I am not very familiar with.. I understand the basics for writing the test cases with Eutester in particular I have learned that you especially need to make sure that you configure a setup and teardown phase in the code as described below in a portion taken from the Vic Iglesias blog:
import unittest from eucaops import Eucaops class MyFirstTest(unittest.TestCase): def setUp(self): self.tester = Eucaops(credpath="/home/ubuntu/.euca") self.keypair = self.tester.add_keypair() self.group = self.tester.add_group() self.tester.authorize_group(self.group) self.tester.authorize_group(self.group, port=-1, protocol="icmp") self.reservation = None def testInstance(self): #### INTERESTING STUFF GOES HERE pass def tearDown(self): if self.reservation is not None: self.tester.terminate_instances(self.reservation) self.tester.delete_keypair(self.keypair) self.tester.local("rm " + self.keypair.name + ".pem") self.tester.delete_group(self.group)
The setup phase makes sure the system has the required elements in order to execute the code, while the teardown releases these elements after execution. I have not yet attempted writing my own test cases as I am still experimenting with the default ones, but even if I never get around to writing my own I am enjoying learning a new programming language and this is good practice running scripts for me.
From the blog michaelkenny2 » WSU CS by michaelkenny2 and used with permission of the author. All other rights reserved by the author.