技术标签: python自动化测试(页面+接口)
转自:http://www.cnblogs.com/yufeihlf/p/5707929.html
unittest单元测试框架不仅可以适用于单元测试,还可以适用WEB自动化测试用例的开发与执行,该测试框架可组织执行测试用例,并且提供了丰富的断言方法,判断测试用例是否通过,最终生成测试结果。今天笔者就总结下如何使用unittest单元测试框架来进行WEB自动化测试。
目录
一、unittest模块的各个属性说明
先来聊一聊unittest模块的各个属性,所谓知己知彼方能百战百胜,了解unittest的各个属性,对于后续编写用例有很大的帮助。
1.unittest的属性如下:
['BaseTestSuite', 'FunctionTestCase', 'SkipTest', 'TestCase', 'TestLoader', 'TestProgram', 'TestResult', 'TestSuite', 'TextTestResult', 'TextTestRunner', '_TextTestResult', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '__unittest', 'case', 'defaultTestLoader', 'expectedFailure', 'findTestCases', 'getTestCaseNames', 'installHandler', 'loader', 'main', 'makeSuite', 'registerResult', 'removeHandler', 'removeResult', 'result', 'runner', 'signals', 'skip', 'skipIf', 'skipUnless', 'suite', 'util']
说明:
unittest.TestCase:TestCase类,所有测试用例类继承的基本类。
class BaiduTest(unittest.TestCase):
unittest.main():使用她可以方便的将一个单元测试模块变为可直接运行的测试脚本,main()方法使用TestLoader类来搜索所有包含在该模块中以“test”命名开头的测试方法,并自动执行他们。执行方法的默认顺序是:根据ASCII码的顺序加载测试用例,数字与字母的顺序为:0-9,A-Z,a-z。所以以A开头的测试用例方法会优先执行,以a开头会后执行。
unittest.TestSuite():unittest框架的TestSuite()类是用来创建测试套件的。
unittest.TextTextRunner():unittest框架的TextTextRunner()类,通过该类下面的run()方法来运行suite所组装的测试用例,入参为suite测试套件。
unittest.defaultTestLoader(): defaultTestLoader()类,通过该类下面的discover()方法可自动更具测试目录start_dir匹配查找测试用例文件(test*.py),并将查找到的测试用例组装到测试套件,因此可以直接通过run()方法执行discover。用法如下:
discover=unittest.defaultTestLoader.discover(test_dir, pattern='test_*.py')
unittest.skip():装饰器,当运行用例时,有些用例可能不想执行等,可用装饰器暂时屏蔽该条测试用例。一种常见的用法就是比如说想调试某一个测试用例,想先屏蔽其他用例就可以用装饰器屏蔽。
@unittest.skip(reason): skip(reason)装饰器:无条件跳过装饰的测试,并说明跳过测试的原因。
@unittest.skipIf(reason): skipIf(condition,reason)装饰器:条件为真时,跳过装饰的测试,并说明跳过测试的原因。
@unittest.skipUnless(reason): skipUnless(condition,reason)装饰器:条件为假时,跳过装饰的测试,并说明跳过测试的原因。
@unittest.expectedFailure(): expectedFailure()测试标记为失败。
2.TestCase类的属性如下:
['__call__', '__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_addSkip', '_baseAssertEqual', '_classSetupFailed', '_deprecate', '_diffThreshold', '_formatMessage', '_getAssertEqualityFunc', '_truncateMessage', 'addCleanup', 'addTypeEqualityFunc', 'assertAlmostEqual', 'assertAlmostEquals', 'assertDictContainsSubset', 'assertDictEqual', 'assertEqual', 'assertEquals', 'assertFalse', 'assertGreater', 'assertGreaterEqual', 'assertIn', 'assertIs', 'assertIsInstance', 'assertIsNone', 'assertIsNot', 'assertIsNotNone', 'assertItemsEqual', 'assertLess', 'assertLessEqual', 'assertListEqual', 'assertMultiLineEqual', 'assertNotAlmostEqual', 'assertNotAlmostEquals', 'assertNotEqual', 'assertNotEquals', 'assertNotIn', 'assertNotIsInstance', 'assertNotRegexpMatches', 'assertRaises', 'assertRaisesRegexp', 'assertRegexpMatches', 'assertSequenceEqual', 'assertSetEqual', 'assertTrue', 'assertTupleEqual', 'assert_', 'countTestCases', 'debug', 'defaultTestResult', 'doCleanups', 'fail', 'failIf', 'failIfAlmostEqual', 'failIfEqual', 'failUnless', 'failUnlessAlmostEqual', 'failUnlessEqual', 'failUnlessRaises', 'failureException', 'id', 'longMessage', 'maxDiff', 'run', 'setUp', 'setUpClass', 'shortDescription', 'skipTest', 'tearDown', 'tearDownClass']
说明:
setUp():setUp()方法用于测试用例执行前的初始化工作。如测试用例中需要访问数据库,可以在setUp中建立数据库连接并进行初始化。如测试用例需要登录web,可以先实例化浏览器。
tearDown():tearDown()方法用于测试用例执行之后的善后工作。如关闭数据库连接。关闭浏览器。
assert*():一些断言方法:在执行测试用例的过程中,最终用例是否执行通过,是通过判断测试得到的实际结果和预期结果是否相等决定的。
assertEqual(a,b,[msg='测试失败时打印的信息']):断言a和b是否相等,相等则测试用例通过。
assertNotEqual(a,b,[msg='测试失败时打印的信息']):断言a和b是否相等,不相等则测试用例通过。
assertTrue(x,[msg='测试失败时打印的信息']):断言x是否True,是True则测试用例通过。
assertFalse(x,[msg='测试失败时打印的信息']):断言x是否False,是False则测试用例通过。
assertIs(a,b,[msg='测试失败时打印的信息']):断言a是否是b,是则测试用例通过。
assertNotIs(a,b,[msg='测试失败时打印的信息']):断言a是否是b,不是则测试用例通过。
assertIsNone(x,[msg='测试失败时打印的信息']):断言x是否None,是None则测试用例通过。
assertIsNotNone(x,[msg='测试失败时打印的信息']):断言x是否None,不是None则测试用例通过。
assertIn(a,b,[msg='测试失败时打印的信息']):断言a是否在b中,在b中则测试用例通过。
assertNotIn(a,b,[msg='测试失败时打印的信息']):断言a是否在b中,不在b中则测试用例通过。
assertIsInstance(a,b,[msg='测试失败时打印的信息']):断言a是是b的一个实例,是则测试用例通过。
assertNotIsInstance(a,b,[msg='测试失败时打印的信息']):断言a是是b的一个实例,不是则测试用例通过。
3.TestSuite类的属性如下:(组织用例时需要用到)
['__call__', '__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__iter__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_addClassOrModuleLevelException', '_get_previous_module', '_handleClassSetUp', '_handleModuleFixture', '_handleModuleTearDown', '_tearDownPreviousClass', '_tests', 'addTest', 'addTests', 'countTestCases', 'debug', 'run']
说明:
addTest(): addTest()方法是将测试用例添加到测试套件中,如下方,是将test_baidu模块下的BaiduTest类下的test_baidu测试用例添加到测试套件。
suite = unittest.TestSuite() suite.addTest(test_baidu.BaiduTest('test_baidu'))
4.TextTextRunner的属性如下:(组织用例时需要用到)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_makeResult', 'buffer', 'descriptions', 'failfast', 'resultclass', 'run', 'stream', 'verbosity']
说明:
run(): run()方法是运行测试套件的测试用例,入参为suite测试套件。
runner = unittest.TextTestRunner() runner.run(suite)
二、使用unittest框架编写测试用例思路
设计基本思路如下:
# coding=utf-8 #1.先设置编码,utf-8可支持中英文,如上,一般放在第一行
#2.注释:包括记录创建时间,创建人,项目名称。
‘’’
Created on 2016-7-27
@author: Jennifer
Project:使用unittest框架编写测试用例思路
‘’’
#3.导入unittest模块
import unittest
#4.定义测试类,父类为unittest.TestCase。
#可继承unittest.TestCase的方法,如setUp和tearDown方法,不过此方法可以在子类重写,覆盖父类方法。
#可继承unittest.TestCase的各种断言方法。
class Test(unittest.TestCase):
#5.定义setUp()方法用于测试用例执行前的初始化工作。
#注意,所有类中方法的入参为self,定义方法的变量也要“self.变量”
#注意,输入的值为字符型的需要转为int型
def setUp(self):
self.number=raw_input(‘Enter a number:’)
self.number=int(self.number)
#6.定义测试用例,以“test_”开头命名的方法
#注意,方法的入参为self
#可使用unittest.TestCase类下面的各种断言方法用于对测试结果的判断
#可定义多个测试用例
#最重要的就是该部分
def test_case1(self):
print self.number
self.assertEqual(self.number,10,msg=‘Your input is not 10’)
</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">def</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;"> test_case2(self):
</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">print</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;"> self.number
self.assertEqual(self.number,</span>20,msg=<span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">'</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">Your input is not 20</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">'</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">)
@unittest.skip(</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">'</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">暂时跳过用例3的测试</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">'</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">)
</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">def</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;"> test_case3(self):
</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">print</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;"> self.number
self.assertEqual(self.number,</span>30,msg=<span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">'</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">Your input is not 30</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">'</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">)
#7.定义tearDown()方法用于测试用例执行之后的善后工作。
#注意,方法的入参为self
def tearDown(self):
print ‘Test over’
#8如果直接运行该文件(name__值为__main),则执行以下语句,常用于测试脚本是否能够正常运行
if name==‘main’:
#8.1执行测试用例方案一如下:
#unittest.main()方法会搜索该模块下所有以test开头的测试用例方法,并自动执行它们。
#执行顺序是命名顺序:先执行test_case1,再执行test_case2
unittest.main()
‘’’
#8.2执行测试用例方案二如下:
#8.2.1先构造测试集
#8.2.1.1实例化测试套件
suite=unittest.TestSuite()
#8.2.1.2将测试用例加载到测试套件中。
#执行顺序是安装加载顺序:先执行test_case2,再执行test_case1
suite.addTest(Test(‘test_case2’))
suite.addTest(Test(‘test_case1’))
#8.2.2执行测试用例
#8.2.2.1实例化TextTestRunner类
runner=unittest.TextTestRunner()
#8.2.2.2使用run()方法运行测试套件(即运行测试套件中的所有用例)
runner.run(suite)
’’’
‘’’
#8.3执行测试用例方案三如下:
#8.3.1构造测试集(简化了方案二中先要创建测试套件然后再依次加载测试用例)
#执行顺序同方案一:执行顺序是命名顺序:先执行test_case1,再执行test_case2
test_dir = ‘./’
discover = unittest.defaultTestLoader.discover(test_dir, pattern=‘test_*.py’)
#8.3.2执行测试用例
#8.3.2.1实例化TextTestRunner类
runner=unittest.TextTestRunner()
#8.3.2.2使用run()方法运行测试套件(即运行测试套件中的所有用例)
runner.run(discover)
‘’’
使用方案一执行测试用例结果如下:
Enter a number:10
10
Test over
Enter a number:.10
Fs
Ran 3 tests in 6.092s
FAILED (failures=1, skipped=1)
10
Test over
因为先执行test_case1,再执行test_case2,所以第一次输入10时,执行通过,返回. 第二次输入10时,执行不通过,返回F,最终一个用例通过,一个用例失败,还有一个用例是直接跳过的(装饰器)。
使用方案二执行测试用例结果如下:
Enter a number:10
10
Test over
Enter a number:F10
.
Ran 2 tests in 4.973s
FAILED (failures=1)
10
Test over
因为先执行test_case2,再执行test_case1,所以第一次输入10时,执行不通过,返回F , 第二次输入10时,执行通过,返回. ,最终一个用例通过,一个用例失败。
使用方案三执行测试用例结果如下(执行测试用例顺序同方案一):
Enter a number:10
10
Test over
Enter a number:.10
Fs
Ran 3 tests in 6.092s
FAILED (failures=1, skipped=1)
10
Test over
因为先执行test_case1,再执行test_case2,所以第一次输入10时,执行通过,返回. 第二次输入10时,执行不通过,返回F,最终一个用例通过,一个用例失败,还有一个用例是直接跳过的(装饰器)。
三、使用unittest框架编写测试用例实例
目录结构:
百度搜索测试用例Test Case:
# coding=utf-8 ''' Created on 2016-7-22 @author: Jennifer Project:登录百度测试用例 ''' from selenium import webdriver import unittest, time
class BaiduTest(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.implicitly_wait(30) #隐性等待时间为30秒
self.base_url = “https://www.baidu.com”
<span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">def</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;"> test_baidu(self):
driver </span>=<span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;"> self.driver
driver.get(self.base_url </span>+ <span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">/</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">)
driver.find_element_by_id(</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">kw</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">).clear()
driver.find_element_by_id(</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">kw</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span>).send_keys(<span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">unittest</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">)
driver.find_element_by_id(</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">su</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">).click()
time.sleep(</span>3<span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">)
title</span>=<span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">driver.title
self.assertEqual(title, u</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">unittest_百度搜索</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">)
</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">def</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;"> tearDown(self):
self.driver.quit()
if name == “main”:
unittest.main()
有道翻译测试用例Test Case:
# coding=utf-8 ''' Created on 2016-7-22 @author: Jennifer Project:使用有道翻译测试用例 ''' from selenium import webdriver import unittest, time
class YoudaoTest(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.implicitly_wait(30) #隐性等待时间为30秒
self.base_url = “http://www.youdao.com”
<span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">def</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;"> test_youdao(self):
driver </span>=<span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;"> self.driver
driver.get(self.base_url </span>+ <span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">/</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">)
driver.find_element_by_id(</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">translateContent</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">).clear()
driver.find_element_by_id(</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">translateContent</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span>).send_keys(u<span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">你好</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">)
driver.find_element_by_id(</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">translateContent</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">).submit()
time.sleep(</span>3<span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">)
page_source</span>=<span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">driver.page_source
self.assertIn( </span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">hello</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">"</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;">,page_source)
</span><span style="font-family:'Courier New' !important;font-size:12px !important;line-height:1.5 !important;">def</span><span style="font-family:'Courier New' !important;color:#000000;font-size:12px !important;line-height:1.5 !important;"> tearDown(self):
self.driver.quit()
if name == “main”:
unittest.main()
web测试用例:通过测试套件TestSuite来组装多个测试用例。
# coding=utf-8 ''' Created on 2016-7-26 @author: Jennifer Project:编写Web测试用例 ''' import unittest from test_case import test_baidu from test_case import test_youdao
#构造测试集
suite = unittest.TestSuite()
suite.addTest(test_baidu.BaiduTest(‘test_baidu’))
suite.addTest(test_youdao.YoudaoTest(‘test_youdao’))
if name==‘main’:
#执行测试
runner = unittest.TextTestRunner()
runner.run(suite)
测试结果:
说明:.代表用例执行通过,两个点表示两个用例执行通过。F表示用例执行不通过。
侯光敏 ([email protected]),简介: 本文详细的介绍了使用Java语言建立一套多线程服务器的过程,该服务器使用对象传递消息,在线程中使用队列机制,使服务器的性能大大提高了。这套服务器可以被用于各种C/S或B/S结构的应用程序中。发布日期: 2002 年 7 月 03 日 级别: 初级 访问情况 : 7451 次浏览 评论: (查看
FF算法:有了Dinic,谁还用FF…EK算法:有了Dinic,谁还用EK…Dinic:#include<bits/stdc++.h>using namespace std;int tot,st,ed,i,j,n,m,head[1111111],ans,dep[1111111],q[1111111];struct eat{ int wi,to,ne;}e[1111111];void add(int x,int y,int z){ e[tot].wi=z; e[tot].t
参考自:https://blog.csdn.net/piantoutongyang/article/details/45470473学习路线 :可以参考慕课网偏头痛杨总结的java后端工程师的主流技术学习路径: 1.java基础阶段 类、对象、变量、接...
Nginx("engine x")是一款是由俄罗斯的程序设计师Igor Sysoev所开发高性能的 Web和反向代理服务器,也是一个 IMAP/POP3/SMTP代理服务器。在高连接并发的情况下,Nginx是Apache服务器不错的替代品。Nginx 安装一、安装编译工具及库文件yum -y install make zlib zlib-deve...
进程(process)和线程(thread)是非常抽象的概念, 也是程序员必需掌握的核心知识。多进程和多线程编程对于代码的并发执行,提升代码效率和缩短运行时间至关重要。小编我今天就来尝试下用一文总结下Python多进程和多线程的概念和区别, 并详细介绍如何使用python的multiprocess和threading模块进行多线程和多进程编程。重要知识点 - 什么是进程(process)...
关于mybatis的学习
今天继续最新版基础入门内容。这一篇简单总结了 Elasticsearch 7.x 之文档、索引和 REST API。什么是文档文档Unique ID文档元数据什么是索引REST API一...
QTP访问SQL数据库Dim conn,resSet conn = createobject("adodb.connection")connstr = "Provider=SQLOLEDB.1;Password=Password01!;Persist Security Info=True;User ID=sa;Initial Catalog=PCRM2;Data Source=ws-g...
package com.zving.demo;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;import org.apache.commons.io.FileUtils;import org.apache.poi.hssf.usermodel.HSSFCell...
MySQL什么是数据库?数据库是一种有效地管理大量的、安全的、并发的、关联的、一致的数据工具;而文件保存数据会存在安全问题,不利于查询和对数据的管理,也不利于存放海量数据;因此,引入了数据库的概念,数据库更便于我们去操纵和管理数据,做一些我们想要的改变。什么是SQL,什么是MySQL?简单点说,SQL是一种用于操作数据库的查询语言,而MySQL是一种数据库软件。MySQL是一个DBMS(D...
Anaconda是一个很好用的Python IDE,它集成了很多科学计算需要使用的python第三方工具包。conda 的使用根据自己的操作系统安装好Anaconda后,在命令行下输入:conda list可以看已经安装好的python第三方工具包,这里我们使用 magic 命令 %%cmd 在 ipython cell 中来执...
目录 使用非对称卷积分解大filters 重新设计pooling层 辅助构造器 使用标签平滑 参考资料在《深度学习面试题20:GoogLeNet(Inception V1)》和《深度学习面试题26:GoogLeNet(Inception V2)》中对前两个Inception版本做了介绍,下面主要阐述V3版本的创新点使用非对称卷积分解大fil...