Currently I would like to define a test suite for 50 test cases via the Python Test Suite, which is included in Unit test.
Unfortunately, the created class refuses to work properly.
Unittest is involved in the import and works.
import unittest
import test
import logging
import random
class SwitchTestComplete(unittest.TestSuite):
def setUp(self):
self.s = SSH(host='xxx.xx.xx.xxx', username='xxxxx', password='xxx')
self.s.query_interactive = True
def suite(self):
suite = unittest.TestSuite()
suite.addTest(SwitchTestComplete('test_accounting_disable'))
suite.addTest(test_account_enable('test_account_enable'))
#suite.addTest(test_accounting_disable('test_create_user'))
#suite.addTest(test_accounting_disable('test_delete_user'))
#suite.addTest(test_accounting_disable('test_delete_admin'))
#suite.addTest(test_accounting_disable('test_create_user_admin'))
#suite.addTest(test_accounting_disable('test_auto_logout'))
self.run(suite)
The Test
def test_create_user(self):
if self.s.login():
q = self.s.query('account')
#switch to prompt account
q = self.s.query('add 10 testuser1 testuser1 ')
q = self.s.query('add 11 testuser2 testuser2 ')
q = self.s.query('add 11 testuser3 testuser3 ')
q = self.s.query('add 11 testuser4 testuser4 ')
q = self.s.query('add 11 testuser5 testuser5 ')
q = self.s.query('add 11 testuser6 testuser6 ')
q = self.s.query('add 11 testuser7 testuser7 ')
q = self.s.query('add 11 testuser8 testuser8 ')
q = self.s.query('add 11 testuser9 testuser9 ')
q = self.s.query('add 11 testuser10 testuser10 ')
import time
print('Wait')
time.sleep(3)
The problem that occurs is that the unit test runs though but does not call the test cases that I have specified here.