Initial version of a regression test framework

This commit is contained in:
Priyanka Shendge
2016-04-17 10:39:08 -04:00
committed by Dave Page
parent ffa348fe5d
commit 98d473a7ec
20 changed files with 907 additions and 32 deletions

View File

@@ -0,0 +1,15 @@
#############################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2016, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##############################################################
from pgadmin.utils.route import BaseTestGenerator
class BrowserGenerateTestCase(BaseTestGenerator):
def runTest(self):
print ("In BrowserGenerateTestCase...")

View File

@@ -0,0 +1,93 @@
# ##########################################################################
#
# #pgAdmin 4 - PostgreSQL Tools
#
# #Copyright (C) 2013 - 2016, The pgAdmin Development Team
# #This software is released under the PostgreSQL Licence
#
# ##########################################################################
from pgadmin.browser.tests.test_login import LoginTestCase
from regression.config import config_data
import uuid
class ChangePasswordTestCase(LoginTestCase):
"""
This class validates the change password functionality
by defining change password scenarios; where dict of
parameters describes the scenario appended by test name.
"""
priority = 2
scenarios = [
# This testcase validates invalid confirmation password
('TestCase for Validating Incorrect_New_Password', dict(
password=(config_data['pgAdmin4_login_credentials']
['test_login_password']),
new_password=(config_data['pgAdmin4_login_credentials']
['test_new_password']),
new_password_confirm=str(uuid.uuid4())[4:8],
respdata='Passwords do not match')),
# This testcase validates if confirmation password is less than
# minimum length
('TestCase for Validating New_Password_Less_Than_Min_Length',
dict(password=(config_data['pgAdmin4_login_credentials']
['test_login_password']),
new_password=str(uuid.uuid4())[4:8],
new_password_confirm=str(uuid.uuid4())[4:8],
respdata='Password must be at least 6 characters')),
# This testcase validates if both password fields are left blank
('TestCase for Validating Empty_New_Password', dict(
password=(config_data['pgAdmin4_login_credentials']
['test_login_password']),
new_password='', new_password_confirm='',
respdata='Password not provided')),
# This testcase validates if current entered password
# is incorrect
('TestCase for Validating Incorrect_Current_Password', dict(
password=str(uuid.uuid4())[4:8],
new_password=(config_data['pgAdmin4_login_credentials']
['test_new_password']),
new_password_confirm=(
config_data['pgAdmin4_login_credentials']
['test_new_password']),
respdata='Invalid password')),
# This testcase checks for valid password
('TestCase for Changing Valid_Password', dict(
password=(config_data['pgAdmin4_login_credentials']
['test_login_password']),
new_password=(config_data['pgAdmin4_login_credentials']
['test_new_password']),
new_password_confirm=(
config_data['pgAdmin4_login_credentials']
['test_new_password']),
respdata='You successfully changed your password.')),
('Reassigning_Password', dict(
password=(config_data['pgAdmin4_login_credentials']
['test_new_password']),
new_password=(config_data['pgAdmin4_login_credentials']
['test_login_password']),
new_password_confirm=(
config_data['pgAdmin4_login_credentials']
['test_login_password']),
respdata='You successfully changed your password.'))
]
def runTest(self):
"""This function will check change password functionality."""
response = self.tester.get('/change', follow_redirects=True)
self.assertIn('pgAdmin 4 Password Change', response.data)
response = self.tester.post('/change', data=dict(
password=self.password,
new_password=self.new_password,
new_password_confirm=self.new_password_confirm),
follow_redirects=True)
self.assertIn(self.respdata, response.data)

View File

@@ -0,0 +1,79 @@
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2016, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
import uuid
from pgadmin.utils.route import BaseTestGenerator
from regression.config import config_data
class LoginTestCase(BaseTestGenerator):
"""
This class checks login functionality by validating different scenarios.
Login scenarios are defined in dictionary; where dict of parameters
describe the scenario appended by test name.
"""
priority = 0
scenarios = [
# This test case validates the invalid/incorrect password
('TestCase for Checking Invalid_Password', dict(
email=(config_data['pgAdmin4_login_credentials']
['test_login_username']),
password=str(uuid.uuid4())[4:8],
respdata='Invalid password')),
# This test case validates the empty password field
('Empty_Password', dict(
email=(config_data['pgAdmin4_login_credentials']
['test_login_username']), password='',
respdata='Password not provided')),
# This test case validates blank email field
('Empty_Email', dict(
email='', password=(config_data['pgAdmin4_login_credentials']
['test_login_password']),
respdata='Email not provided')),
# This test case validates empty email and password
('Empty_Creadentials', dict(
email='', password='',
respdata='Email not provided')),
# This test case validates the invalid/incorrect email id
('Invalid_Email', dict(
email=str(uuid.uuid4())[1:6] + '@xyz.com',
password=(config_data['pgAdmin4_login_credentials']
['test_login_password']),
respdata='Specified user does not exist')),
# This test case validates invalid email and password
('Invalid_Creadentials', dict(
email=str(uuid.uuid4())[1:6] + '@xyz.com',
password=str(uuid.uuid4())[4:8],
respdata='Specified user does not exist')),
# This test case validates the valid/correct credentials and allow user
# to login pgAdmin 4
('Valid_Creadentials', dict(
email=(config_data['pgAdmin4_login_credentials']
['test_login_username']),
password=(config_data['pgAdmin4_login_credentials']
['test_login_password']),
respdata='You are currently running version'))
]
def runTest(self):
"""This function checks login functionality."""
response = self.tester.post('/login', data=dict(
email=self.email, password=self.password),
follow_redirects=True)
self.assertIn(self.respdata, response.data)

View File

@@ -0,0 +1,44 @@
# ##########################################################################
#
# #pgAdmin 4 - PostgreSQL Tools
#
# #Copyright (C) 2013 - 2016, The pgAdmin Development Team
# #This software is released under the PostgreSQL Licence
#
# ##########################################################################
from pgadmin.browser.tests.test_login import LoginTestCase
from regression.config import config_data
class LogoutTest(LoginTestCase):
"""
This class verifies the logout functionality; provided the user is already
logged-in. Dictionary parameters define the scenario appended by test
name.
"""
priority = 3
scenarios = [
# This test case validate the logout page
('Logging Out', dict(respdata='Redirecting...'))
]
def runTest(self):
"""This function checks the logout functionality."""
response = self.tester.get('/logout')
self.assertIn(self.respdata, response.data)
def tearDown(self):
"""
Defining tear down class, which will run after each test method execute.
Re-logging in as further modules require login.
"""
self.tester.post('/login', data=dict(
email=(config_data['pgAdmin4_login_credentials']
['test_login_username']),
password=(config_data['pgAdmin4_login_credentials']
['test_login_password'])), follow_redirects=True)

View File

@@ -0,0 +1,47 @@
# ##########################################################################
#
# #pgAdmin 4 - PostgreSQL Tools
#
# #Copyright (C) 2013 - 2016, The pgAdmin Development Team
# #This software is released under the PostgreSQL Licence
#
# ##########################################################################
import uuid
from pgadmin.utils.route import BaseTestGenerator
from regression.config import config_data
class ResetPasswordTestCase(BaseTestGenerator):
"""
This class validates the reset password functionality by defining
scenarios; Each dict parameter describe a scenario appended by
test name.
"""
priority = 1
scenarios = [
# This test case validates the empty email field
('TestCase for Validating Empty Email', dict(
email='', respdata='Email not provided')),
# This test case validates the invalid/incorrect email field
('TestCase for Validating Invalid_Email', dict(
email=str(uuid.uuid4())[1:6] + '@xyz.com',
respdata='Specified user does not exist')),
# This test case validates the valid email id
('TestCase for Validating Valid_Email', dict(
email=config_data['pgAdmin4_login_credentials']
['test_login_username'], respdata='pgAdmin 4'))
]
def runTest(self):
"""This function checks reset password functionality."""
response = self.tester.get('/reset')
self.assertIn('Recover pgAdmin 4 Password', response.data)
response = self.tester.post(
'/reset', data=dict(email=self.email),
follow_redirects=True)
self.assertIn(self.respdata, response.data)