'''
coding=utf-8
Created on 2016-7-27
@author: Jennifer
Project:使用unittest框架编写测试用例思路
使用python版本python2
2019-1-17修改人:楼小宴 使用版本:python3
'''
import unittest
def setUp(self):
self.a = int(input('Enter a number:'))
self.b = int(input('Enter b number:'))
self.c = [i for i in range(10)]
self.connect = "and"
# 6.定义测试用例,以“test_”开头命名的方法
# 注意,方法的入参为self
# 可使用unittest.TestCase类下面的各种断言方法用于对测试结果的判断
# 可定义多个测试用例
# 最重要的就是该部分
def test_case1(self):
print(self.a, self.b)
self.assertEqual(self.a, self.b, msg='a and b is equal')
def test_case2(self):
print(self.a, self.b)
self.assertIn(self.a, self.c, msg='a 在0到9中间')
self.assertNotIn(self.b, self.c, msg='b 不在0到9中间')
@unittest.skip('暂时跳过用例3的测试')
def test_case3(self):
print(self.a)
self.assertEqual(self.a, 11, msg='Your input is not 11')
'''