练习接口测试详细步骤,阿里程序员的软件测试之路

先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前阿里P7

深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年最新软件测试全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
img
img
img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上软件测试知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

如果你需要这些资料,可以添加V获取:vip1024b (备注软件测试)
img

正文

其实,其实 有了这个基础 应该倒腾自动化的其他就不难了

第一版 unittest 框架源码

1 # Lawsuit_interface_unittest.py
2 # coding:utf-8
3
4 import json
5 import unittest
6 from suds.client import Client
7
8
9 class Lawsuit_interface_testing(unittest.TestCase):
10
11 def setUp(self):
12 self.url = “http://…:8080/sys/webservice/sysNotifyTodoWebService?wsdl”
13 self.client = Client(self.url) #
14
15 def tearDown(self):
16 pass
17
18 def test_getTodo(self):
19
20 notify_TodoGetContext = self.client.factory.create(
21 ‘notifyTodoGetContext’)
22 notify_TodoGetContext.otherCond = “”
23 notify_TodoGetContext.pageNo = 1
24 notify_TodoGetContext.rowSize = 3
25 notify_TodoGetContext.targets = json.dumps(
26 {“LoginName”: “xiaoming”})
27 notify_TodoGetContext.type = 1
28 notify_TodoAppResult = self.client.service.getTodo(
29 notify_TodoGetContext)
30 returnState = notify_TodoAppResult.returnState
31 self.assertEqual(returnState, 2)
32
33 def test_sendTodo(self):
34
35 notify_TodoSendContext = self.client.factory.create(
36 ‘notifyTodoSendContext’)
37 notify_TodoSendContext.appName = “Lawsuit”
38 notify_TodoSendContext.createTime = “2015-11-27 15:32:39”
39 notify_TodoSendContext.key = ‘’
40 notify_TodoSendContext.link = ‘http://wwww.baidu.com’
41 notify_TodoSendContext.subject = ‘Lawsuit_testing’
42 notify_TodoSendContext.modelId = ‘123456789’
43 notify_TodoSendContext.modelName = “Lawsuit”
44 notify_TodoSendContext.targets = json.dumps(
45 {“LoginName”: “xiaoming”})
46 notify_TodoSendContext.type = 1
47 notify_TodoAppResult = self.client.service.sendTodo(
48 notify_TodoSendContext)
49 returnState = notify_TodoAppResult.returnState
50 self.assertEqual(returnState, 2)
51
52 def test_deleteTodo(self):
53
54 notify_TodoRemoveContext = self.client.factory.create(
55 ‘notifyTodoRemoveContext’)
56 notify_TodoRemoveContext.appName = “Lawsuit”
57 notify_TodoRemoveContext.modelId = ‘123456789’
58 notify_TodoRemoveContext.key = ‘’
59 notify_TodoRemoveContext.modelName = “Lawsuit”
60 notify_TodoRemoveContext.optType = 1
61 notify_TodoRemoveContext.targets = json.dumps(
62 {“LoginName”: “xiaoming”})
63 notify_TodoAppResult = self.client.service.deleteTodo(
64 notify_TodoRemoveContext)
65 returnState = notify_TodoAppResult.returnState
66 self.assertEqual(returnState, 2)
67
68 def test_setTodoDone(self):
69
70 notify_TodoRemoveContext = self.client.factory.create(
71 ‘notifyTodoRemoveContext’)
72 notify_TodoRemoveContext.appName = “Lawsuit”
73 notify_TodoRemoveContext.modelId = ‘123456789’
74 notify_TodoRemoveContext.key = ‘’
75 notify_TodoRemoveContext.modelName = “Lawsuit_testing”
76 notify_TodoRemoveContext.optType = 1
77 notify_TodoRemoveContext.targets = json.dumps(
78 {“LoginName”: “xiaoming”})
79 notify_TodoAppResult = self.client.service.setTodoDone(
80 notify_TodoRemoveContext)
81 returnState = notify_TodoAppResult.returnState
82 self.assertEqual(returnState, 2)
83
84
85 if name == ‘main’:
86 unittest.main()

第二版 使用excel 数据驱动

1 # Lawsuit_interface_unittest_excel_v1.1.py
2 # coding:utf-8
3
4 import unittest
5 import json
6 import xlrd
7 from suds.client import Client
8 import time
9 import sys
10
11
12 class Lawsuit_interface_testing(unittest.TestCase):
13
14 def setUp(self):
15 self.url =‘http:// xx?wsdl’
16 self.client = Client(self.url)
17 self.xlsfile = r’lawsuit_casedata.xlsx’
18 self.excel_data(self.xlsfile)
19
20 def tearDown(self):
21 pass
22
23 def test_getToDO(self):
24
25 self.Cannot_find_file(self.xlsfile)
26
27 notify_TodoGetContext = self.client.factory.create(
28 ‘notifyTodoGetContext’)
29 notify_TodoGetContext.pageNo = self.pageNo_value
30 notify_TodoGetContext.rowSize = self.rowSize_value
31 # another way to json
32 # notify_TodoGetContext.targets = “{ “LoginName”: “xiaoming” }”
33 notify_TodoGetContext.targets = self.targets_value
34 notify_TodoGetContext.type = self.ptype_value
35
36 notify_TodoAppResult = self.client.service.getTodo(
37 notify_TodoGetContext)
38 returnState = notify_TodoAppResult.returnState
39
40 print returnState
41 self.assertEqual(returnState, 2)
42
43 def test_sendTodo(self):
44 self.Cannot_find_file(self.xlsfile)
45
46 notify_TodoSendContext = self.client.factory.create(
47 ‘notifyTodoSendContext’)
48 notify_TodoSendContext.appName = self.appName_value
49 notify_TodoSendContext.createTime = self.creatime_value
50 # notify_TodoSendContext.key = ‘’
51 notify_TodoSendContext.link = self.link_value
52 notify_TodoSendContext.subject = self.subject_value
53 notify_TodoSendContext.modelId = self.modelId_value
54 notify_TodoSendContext.modelName = self.modelName_value
55 notify_TodoSendContext.targets = self.targets_value
56 notify_TodoSendContext.type = self.ptype_value
57 notify_TodoAppResult = self.client.service.sendTodo(
58 notify_TodoSendContext)
59 returnState = notify_TodoAppResult.returnState
60 self.assertEqual(returnState, 2)
61
62 def test_deleteTodo(self):
63 self.Cannot_find_file(self.xlsfile)
64
65 notify_TodoRemoveContext = self.client.factory.create(
66 ‘notifyTodoRemoveContext’)
67 notify_TodoRemoveContext.appName = self.appName_value
68 notify_TodoRemoveContext.modelId = self.modelId_value
69 # notify_TodoRemoveContext.key = ‘’
70 notify_TodoRemoveContext.modelName = self.modelName_value
71 notify_TodoRemoveContext.optType = self.optType_value
72 notify_TodoRemoveContext.targets = self.targets_value
73 notify_TodoAppResult = self.client.service.deleteTodo(
74 notify_TodoRemoveContext)
75 returnState = notify_TodoAppResult.returnState
76 self.assertEqual(returnState, 2)
77
78 def test_setTodoDone(self):
79 self.Cannot_find_file(self.xlsfile)
80
81 notify_TodoRemoveContext = self.client.factory.create(
82 ‘notifyTodoRemoveContext’)
83 notify_TodoRemoveContext.appName = self.appName_value
84 notify_TodoRemoveContext.modelId = self.modelId_value
85 # notify_TodoRemoveContext.key = ‘’
86 notify_TodoRemoveContext.modelName = self.modelName_value
87 notify_TodoRemoveContext.optType = self.optType_value
88 notify_TodoRemoveContext.targets = self.targets_value
89 notify_TodoAppResult = self.client.service.setTodoDone(
90 notify_TodoRemoveContext)
91 returnState = notify_TodoAppResult.returnState
92 self.assertEqual(returnState, 2)
93
94 def excel_data(self, xlsfile):
95
96 self.Cannot_find_file(self.xlsfile)
97 book = xlrd.open_workbook(xlsfile)
98 api_sheet = book.sheet_by_index(0)
99 nrows = api_sheet.nrows
100 for i in range(1, nrows):
101 caseID = api_sheet.cell(i, 0)

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以添加V获取:vip1024b (备注软件测试)
img

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

需要这份系统化的资料的朋友,可以添加V获取:vip1024b (备注软件测试)
[外链图片转存中…(img-yOj40fLk-1713593808385)]

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  • 24
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值