Quality Assurance Mentoring, Security and ‘Welcome to Earf’

on

QA Mentoring

Luke Skywalker had Obi Wan/Yoda, Gandhi’s mentor was Dadabhai Naoroji and in turn, Gandhi was an inspiration for people such as Martin Luther King, Jr and Nelson Mandela.

Why am I talking about mentors, basically I have a good opportunity to help guide an individual who is interested in the Quality Assurance field. Even though I do not know all the answers (or even the questions to ask), I offered to be a guide/mentor so that they can take their first steps towards being a tester/Quality Assurance Engineer.

They say that you should have objectives, otherwise what’s the point. So from my side of the ‘relationship’, my aims are:

  • To help spread the knowledge of what it means to be involved in this field and what it means to have a career rather than a job (although I’ve only been doing this for 9/10-ish years. Still a newbie in comparison.
  • I feel that having to explain concepts/come up with objectives means that I can gain a deeper understanding of topics and even go over the basics of testing.
  • I might get interested in another field and find new concepts that I would not have been exposed to.
  • I feel that I will get a chance to practise my listening skills, potential leadership skills and general soft skills.

I need to sit down with the individual and find out what their objectives are. Although the big one is to eventually get a job in the industry. So part of what I plan to suggest is to look at what is already out there and start to think critically (Bugs in the wild), read books (Agile testing, ISTQB Foundation Software Book, various blogs), I even suggested to start a blog so that they can chronicle their journey and look how they’ve changed over the months/years. I’m also big on good bug reports and communication is key with other people in the business.

I also suggested looking into the Software Testing Club, twitter, Weekend Testing, uTest and another project (which I will get onto later). I think that would be a good start.

So my question is to you, if you had the chance to mentor someone? What pearls of wisdom would you impart, what would you ‘teach’ them. How would you ensure that you’re being the ‘Best mentor you can be’.

QA Security

I had a nice training session yesterday regarding Web Application Security and as usual, I was all ears. This is the field that I eventually want to specialise in, I want to be able to define policies and procedures. I want to be able to get my hands on the latest tools and go wild on them. There is something about this type of testing that appeals to me. So for now to get more information regarding how to incorporate it into my working practise, I plan to read the OWASP version 3/4 testing guide and see what important information I can convey to management.

It’s amazing that the most highly listed vulnerability is the easiest to implement. It’s always nice to read about zero day exploits, DDOS attacks, the top 10 OWASP invulnerability. I plan to get backtrack and have a good attempt at it.

I’m going to get a copy of the Web Hackers Handbook and read it.

Python/Pygame Project.

So after much frustation, I finally got somewhere with my pet project. It is basically a side scroller where you get to shoot aliens. It was a biggie for me as I am trying to learn about Object Oriented Programming and how to use classes, how to __init__ the various characteristics so that other pieces of code can use it. The stage I was before was that I had the background, stars scrolling, the player ship but no aliens. For a good portion of the week, I was stuck on how to draw the aliens on screen and get them to move across.

I finally did it sort of.

I managed to get the aliens on screen and you can shoot them and you’re score goes up. What I need to do is limit the amount of aliens at once. That’s the problem. Here is the code so far:

</pre>
import os, pygame, random
from pygame.locals import *

# game constants
SCORE = 0
MAX_STARS = 45
screen_height = 640
screen_width = 700
SCREENRECT = Rect(0, 0, screen_height, screen_width)
main_dir = os.path.split(os.path.abspath(__file__))[0]
random.seed()

def imgcolorkey(image, colorkey):
 if colorkey is not None:
 if colorkey is -1:
 colorkey = image.get_at((0, 0))
 image.set_colorkey(colorkey, RLEACCEL)
 return image

def load_image(filename, colorkey = None):
 filename = os.path.join('images', filename)
 image = pygame.image.load(filename).convert()
 return imgcolorkey(image, colorkey)

class dummysound:
 def play(self): pass

def load_sound(file):
 if not pygame.mixer: return dummysound()
 file = os.path.join(main_dir, 'data', file)
 try:
 sound = pygame.mixer.Sound(file)
 return sound
 except pygame.error:
 print ('Warning, unable to load, %s' % file)
 return dummysound()

class SpriteSheet:
 def __init__(self, filename):
 self.sheet = load_image(filename)
 def imgat(self, rect, colorkey = None):
 rect = Rect(rect)
 image = pygame.Surface(rect.size).convert()
 image.blit(self.sheet, (0, 0), rect)
 return imgcolorkey(image, colorkey)
 def imgsat(self, rects, colorkey = None):
 imgs = []
 for rect in rects:
 imgs.append(self.imgat(rect, colorkey))
 return imgs

# each type of game object gets an init and an
# update function. the update function is called
# once per frame, and it is when each object should
# change its current position and state

class PlayerShip(pygame.sprite.Sprite):
 guns = [(65, 15)] #Co-ordinates of where the guns are. Used gimp to find co-ordinates
 reloadtime = 10 #How fast the bullets fly
 def __init__(self):
 pygame.sprite.Sprite.__init__(self, self.containers)
 self.rect = self.image.get_rect()
 self.justfired = 0
 self.reloadtimer = 0
 def update(self):
 self.rect.center = pygame.mouse.get_pos()
 self.rect = self.rect.clamp(SCREENRECT)
 if self.reloadtimer > 0:
 self.reloadtimer = self.reloadtimer -1
 firing = pygame.mouse.get_pressed()[0]
 if firing and (not self.justfired or self.reloadtimer == 0):
 self.reloadtimer = self.reloadtime
 for gun in self.guns:
 Shot((self.rect.left + gun[0], self.rect.top + gun[1]))
 self.justfired = firing

&nbsp;
class AlienDrone(pygame.sprite.Sprite):
 # Keep a master copy of the images so that they only need to
 # be loaded once pygame.image.load(os.path.join("images","aliendrone.png")).convert()
 # pygame.rect.Rect((screen_width, (random.randrange(0,screen_height))), self.image.get_size())

 def __init__(self):
 pygame.sprite.Sprite.__init__(self, self.containers)
 self.image = pygame.image.load(os.path.join("images","aliendrone.png")).convert()
 self.rect = pygame.rect.Rect((screen_width, (random.randrange(0,screen_height))), self.image.get_size())
 self.dx = -10

 def update(self):
 self.rect.centerx += self.dx

if self.rect.right < 0:
 self.kill()

class Explosion(pygame.sprite.Sprite):
 defaultlife = 12
 animcycle = 3
 images = []
 def __init__(self, actor):
 pygame.sprite.Sprite.__init__(self, self.containers)
 self.image = self.images[0]
 self.rect = self.image.get_rect(center=actor.rect.center)
 self.life = self.defaultlife

def update(self):
 self.life = self.life - 1
 self.image = self.images[self.life/self.animcycle%2]
 if self.life <= 0: self.kill()
class Shot(pygame.sprite.Sprite):
 speed = 20
 def __init__(self, pos):
 pygame.sprite.Sprite.__init__(self, self.containers)
 self.rect = self.image.get_rect()
 self.rect.center = pos

 def update(self):
 self.rect.move_ip(self.speed, 0 )
 if self.rect.x > screen_width:
 self.kill()

class Score(pygame.sprite.Sprite):
 def __init__(self):
 pygame.sprite.Sprite.__init__(self)
 self.font = pygame.font.Font(None, 20)
 self.font.set_italic(1)
 self.color = Color('white')
 self.lastscore = -1
 self.update()
 self.rect = self.image.get_rect().move(470, 450)

def update(self):
 if SCORE != self.lastscore:
 self.lastscore = SCORE
 msg = "Total Score: %d" % SCORE
 self.image = self.font.render(msg, 0, self.color)

stars = []
aliens = []

for i in range(MAX_STARS):
 star = [random.randrange(0,screen_height-1), random.randrange(0,screen_width-1), random.randrange(1,16)]
 stars.append(star)

def main():
 pygame.init()
 if pygame.mixer and not pygame.mixer.get_init():
 print ('Warning, no sound')
 pygame.mixer = None

# set the display mode
 winstyle = 0
 bestdepth = pygame.display.mode_ok(SCREENRECT.size, winstyle, 32)
 screen = pygame.display.set_mode(SCREENRECT.size, winstyle, bestdepth)
 pygame.mouse.set_visible(False)

# load images, assign to sprite classes
 # (do this before the classes are used, after screen setup)

 spritesheet = SpriteSheet('tyrian.shp.000000.png')
 Shot.image = spritesheet.imgat((0, 0, 13, 13), -1)
 PlayerShip.image = pygame.image.load(os.path.join("images","fighter.png")).convert()

img = load_image('enemyexplosion.png')
 Explosion.images = [img, pygame.transform.flip(img, 1, 1)]

 # decorate the game window
 pygame.display.set_caption('Prototype Demo')

# initialize game groups
 shots = pygame.sprite.Group()
 aliendrone = pygame.sprite.Group()
 all = pygame.sprite.RenderUpdates()

 #load the sound effects
 shoot_sound = load_sound('laser9.wav')

 if pygame.mixer:
 music = os.path.join(main_dir, 'data', 'choral1.wav')
 pygame.mixer.music.load(music)
 pygame.mixer.music.play(-1)

# assign default groups to each sprite class
 PlayerShip.containers = all
 Shot.containers = shots, all
 AlienDrone.containers = aliendrone, all
 Explosion.containers = all

 #Create Some Starting Values
 global score
 clock = pygame.time.Clock()

#initialize our starting sprites
 global SCORE
 if pygame.font:
 all.add(Score())

 clock = pygame.time.Clock()

playerShip = PlayerShip()
 drone = AlienDrone()

 while 1:

numberAlien = 5

 # get input
 for event in pygame.event.get():
 if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
 return
 if event.type == MOUSEBUTTONDOWN:
 shoot_sound.play()

# update all the sprites
 all.update()

# Detect collisions
 for alien in pygame.sprite.spritecollide(playerShip, aliendrone, 1):
 #boom_sound.play()
 #Explosion(aliendrone)
 #Explosion(playerShip)
 playerShip.kill()

for alien in pygame.sprite.groupcollide(shots, aliendrone, 1, 1).keys():
 #boom_sound.play()
 #Explosion(aliendrone)
 SCORE = SCORE + 1
 #draw the scene
 screen.fill((0, 0, 0))
 all.draw(screen)
 for star in stars:
 star[0] -= star[2]
 if star[0] < 0:
 star[0] = screen_height
 screen.set_at((star[0], star[1]), (255,255,255))

 pygame.display.flip()

aliendrone.add(AlienDrone())

 clock.tick(30)

 if pygame.mixer:
 pygame.mixer.music.fadeout(1000)
 pygame.time.wait(1000)
 pygame.quit()
if __name__ == '__main__': main()
<pre>

If that doesn’t look nice, the pastebin is here – http://pastebin.com/xkd7gME5

So what I plan to do is give this to my mentoree (is that a word)? and say, “Do some exploratory testing and see what you can find, anything that you find. Give me a good bug report and we’ll go from there”. Hopefully by doing it this way, it can be fun and still practise the skills needed.

Basic Requirements:

  • Aliens should come in from right to left
  • Player should be able to move around with the keys and/or mouse
  • Aliens should explode when shot at
  • Score should increment when aliens are destroyed
  • Game should display a start again when player is killed
  • All collisions should have a sound/explosion associated with it
  • Ship should not be able to go out of the screen bounds

Future scope

  • Different types of shooting depending on power-up
  • Levels – After a certain score, the number of aliens increase and the aliens get faster
  • High Score table
  • Since this is a proof of concept/learning game, the requirements are ever growing (to a point)

Here is the video so far. If you use the code and launch it (it does have music – which I got from freesound)

I want to do a variety of genres after this, (platform, an RPG – Think Zelda, a shoot em up and maybe a RTS). It should be interesting and I’m having fun and learning a lot. It’s helping me at work as I can now understand a little bit of what techno-babble they speak when it comes to code. Plus the amount of testing that I’ve had to do to get to this stage is mind blowing. (Does this work, no – Let’s try again).

Anyway, as usual  – If you have any comments, then please let me know.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s