软件测试___ 杭州面试题__一部测试岗笔试题(Software testing___ Hangzhou interview questions__ A test post pen test question)

1、 请列举你常用的Linux指令。

ping  查看网址

ssh + ip地址  连接服务器

/etc/init.d/sshd restart 重启sshd服务

su 用户名  切换用户

cd .

cd ../..

cd ~   进入root用户的家目录

cd /home  进入普通用户的家目录

cd /

ls

ls -a   列举当前目录下所有的文件和目录(包含隐藏文件)

ll    列举当前目录下所有的文件和目录

ls -l

mkdir 创建目录

mkdir -p a/b/c  创建联级目录

mkdir a b c 创建平级目录

touch 文件名     创建文件

touch a b c

cat    查看文件内容全部显示

less  查看文件内容上下左右翻页显示

more  查看文件内容以百分比显示

cat a>b   cat a>>b   覆盖和追加

cat a.txt|grep “Python”   ==》在a.txt文件中查询Python字符串

head 文件名   默认查看前10行

tail  文件名   默认查看末尾10行

head -n  5  查看前5行

tail -n  5  查看末尾5行

tail -n +5  从第5行开始

查看文件a.txt的第5到10行

2、 Linux系统中有一个正在改变的日志文件catalina.out,请你将日志文件当前的实时变化输出到另一个新文件test.log中。

1)进入Tomcat的日志目录,执行命令: cd/usr/local/tomcat/logs

2)查看tomcat里面的catalina.out日志

3)查看日志执行命令:

① tail命令:查看文本的结尾内容;

tail catalina.out,查看文本catalina.out;

tail -5 catalina.out,查看文本后5行;

tail -f catalina.out,查看文本实时更新的内容;

② less命令:按照页面显示文本内容;

less catalina.out

pageup 向上翻一页 (向上整翻一页)

pagedown 向下翻一页 (向下整翻一页)

↑ 向上翻一行

↓ 向下翻一行

/关键字 向下搜索该字符

?关键字 向上搜索该字符

q 离开(类似quit退出)

③more命令:less与more相似,按照页面显示文本内容;

more catalina.out

空格键 代表向下翻页 (向下整翻一页)

Enter 下翻一行

/关键字 向下搜索该字符

b 回滚

q 离开

4)查看关键字:

/关键字 向下搜索该字符

?关键字 向上搜索该字符

5)翻页与翻行:

pageup 向上翻一页

pagedown、空格键 向下翻一页

↑ 、n 向上翻一行

↓、Enter 向下翻一行

6)结束查看当前日志:

q(类似quit退出)

3、 

4、 在应用服务器上发布了一个名为“promotion”的应用,发布目录为/home/promotion/apache-tomcat/webapps/。

(1) 你知道哪些方法可以判断该应用是否正在运行?  ps -ef|grep

(2) 你如何知道该应用发布的端口信息?losf -i

5、 数据库中表employee包含employee_id, employee_name, depart_id, depart_name, salary字段,请写出SQL语句

(1)按部门的字符串顺序排序,查询各部门员工的平均工资(不包含“HR”部门)

(2)查询“张三”所在的部门的每个员工的姓名和员工号

1、SELECT depart_name, AVG(wage)

FROM employee

WHERE depart_name <> ‘HR’;

2、select employee_name, depart_id from student where employee_name=张三

6、 你是否熟练使用JMeter做接口测试和性能测试?

(1)在编写脚本的过程中你使用过哪些前置处理器和后置处理器?请介绍它们的使用场景。前置处理器:读取文档变量,在设置环境变量

后置处理器:断言

(2)JMeter中用户定义的变量(User Defined Variables)和用户参数(User Parameters)的区别是什么?

区别:

(1)User Defined Variables导入文档,表格, 用户参数是直接添加

(3)请列举你知道的性能测试指标。

性能测试指标:

响应时间、吞吐量、tps、事务处理数、cpu、网络、内存、i/o、点击率、点击量

(4)请说明性能测试中响应时间和吞吐量的关系。

响应时间是一个系统最重要的指标之一,它的数值大小直接反应了系统的快慢。响应时间是指执行一个请求从开始到最后收到响应数据所花费的总体时间。

响应时间=发起请求网络传输时间+服务器处理时间+返回响应网络传输时间

吞吐量:单位时间内处理的请求数量(事务/s)(衡量网络)

吞吐量是指单位时间内系统能处理的请求数量,体现系统处理请求的能力,这是目前最常用的性能测试指标。

区别:1、响应时间在处理的结果时间  ,吞吐量:处理能力

7、 请根据以下接口规范及业务流程描述设计相应的接口测试用例

getPaperBookList请求参数

参数名称

是否必须

类型

默认值

描述

queryWord

true

string

 

搜索词

goodsTypeId

false

string

1503

商品类型ID,过滤用。目前只有纸书类型1503,后续会增加,默认1503

pageSize

false

string

5

页长默认5

pageNo

false

string

1

页码,默认1

参数名称

是否必须

类型

默认值

描述

queryWord

true

string

搜索词

goodsTypeId

false

string

1503

商品类型ID,过滤用。目前只有纸书类型1503,后续会增加,默认1503

pageSize

false

string

5

页长,默认5

pageNo

false

string

1

页码,默认1

getPaperBookList响应数据

参数名称

是否必须

数据类型

描述

hasNext

true

boolean

是否有下一页

totalCount

true

number

按类型搜索结果的总数量

paperBookList

false

array[object]

搜索结果集

   id

true

string

商品id

   image

true

string

封面

   name

true

string

书名

   authorName

true

string

作者

   cpMark

true

string

来源供应商

   price

true

number

价格

参数名称

是否必须

数据类型

描述

hasNext

true

boolean

是否有下一页

totalCount

true

number

按类型搜索结果的总数量

paperBookList

false

array[object]

搜索结果集

   id

true

string

商品id

   image

true

string

封面

   name

true

string

书名

   authorName

true

string

作者

   cpMark

true

string

来源供应商

   price

true

number

价格

getPaperBookList接口流程描述:

l if (queryWord为空) 返回错误码22003

l 根据请求入参(pageNo默认值为1,pageSize默认值是5,goodsTypeId默认值是1503),取缓存KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO,返回值为对象A

  • (A == IS_NULL) 返回成功响应,hasNext=false,totalCount=0
  • (A == 纸质书缓存对象) ,根据pageNo和pageSize对A中的图书对象列表进行分页,返回成功响应及分页后的结果
  • (A == null)调书城http接口,结果为对象B;

(1)if (B == null) ,存IS_NULL无效缓存,返回成功响应,hasNext=false,totalCount=0

(2)else:根据入参goodsTypeId对B过滤得到对象C;将结果C放入缓存;根据入参pageNo和pageSize对C中的图书对象列表分页,返回成功响应及分页后的结果

getPaperBookList接口流程图

ym_001

getPaperBookList获取页面列表接口

获取页面列表接口成功

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  B ==NULL

queryWord:狼图腾
goodsTypeId:1503
pageSize:5
pageNo:1

hasNext:1
totalCount:5
paperBookList:
   id:001
   image:bf
   name:狼图腾
   authorName:狼
   cpMark:A
   price:20

ym_002

获取页面列表接口__搜索词为空

 

queryWord: 空
goodsTypeId:1503
pageSize:5
pageNo:1

msg:2003

ym_002

获取页面列表接口__缓存为空 请求成功

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  为空

queryWord: 书名
goodsTypeId:1503
pageSize:5
pageNo:1

hasNext:false
totalCount:0

ym_003

获取页面列表接口__缓存存在——分页 请求成功

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  ==纸质书缓存对象

queryWord: 书名
goodsTypeId:1503
pageSize:5
pageNo:1

hasNext: true
totalCount:20
paperBookList:
   id:商品id
   image:
   name:
   authorName:
   cpMark:A
   price:

 

获取页面列表接口__缓存为null 分页

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  ==null

queryWord: 书名
goodsTypeId:1503
pageSize:5
pageNo:1

hasNext:
totalCount:
paperBookList:
   id:001
   image:bf
   name:狼图腾
   authorName:狼
   cpMark:B
   price:20

 

获取页面列表接口__

 

 

hasNext:FALSE
totalCount:0
paperBookList:
   id:001
   image:bf
   name:狼图腾
   authorName:狼
   cpMark:B
   price:20

ym_001

getPaperBookList获取页面列表接口

获取页面列表接口成功

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  B ==NULL

queryWord:狼图腾goodsTypeId:1503pageSize:5pageNo:1

hasNext:1totalCount:5paperBookList:   id:001   image:bf   name:狼图腾   authorName:狼   cpMark:A   price:20

ym_002

获取页面列表接口__搜索词为空

queryWord: 空goodsTypeId:1503pageSize:5pageNo:1

msg:2003

ym_002

获取页面列表接口__缓存为空 请求成功

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  为空

queryWord: 书名goodsTypeId:1503pageSize:5pageNo:1

hasNext:falsetotalCount:0

ym_003

获取页面列表接口__缓存存在——分页 请求成功

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  ==纸质书缓存对象

queryWord: 书名goodsTypeId:1503pageSize:5pageNo:1

hasNext: truetotalCount:20paperBookList:   id:商品id   image:   name:   authorName:   cpMark:A   price:

获取页面列表接口__缓存为null 分页

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  ==null

queryWord: 书名goodsTypeId:1503pageSize:5pageNo:1

hasNext:totalCount:paperBookList:   id:001   image:bf   name:狼图腾   authorName:狼   cpMark:B   price:20

获取页面列表接口__

hasNext:FALSEtotalCount:0paperBookList:   id:001   image:bf   name:狼图腾   authorName:狼   cpMark:B   price:20

————————

1、   Please list your commonly used linux instructions.

ping   View URL

SSH + IP address   Connect server

/etc/init.d/sshd restart 重启sshd服务

Su user name   Switch users

cd .

cd ../..

cd ~    Enter the root user’s home directory

cd /home   Enter the home directory of ordinary users

cd /

ls

ls -a    List all files and directories in the current directory (including hidden files)

ll     List all files and directories in the current directory

ls -l

MKDIR create directory

mkdir -p a/b/c   Create a cascading directory

MKDIR a B C create a peer directory

Touch file name      create a file

touch a b c

cat     View all file contents

less   View the contents of the file and page up, down, left and right

more   View file contents as a percentage

cat a> b    cat a>& gt; b    Overlay and append

cat a.txt|grep “Python”    ==》 Query Python strings in a.txt file

Head file name    The first 10 rows are viewed by default

tail   File name    The default view is the last 10 lines

head -n   five   View the first 5 lines

tail -n   five   View the last 5 lines

tail -n +5   Start on line 5

Look at lines 5 to 10 of the file a.txt

2、   There is a changing log file catalina.out in the Linux system. Please output the current real-time changes of the log file to another new file test.log.

1) Enter the Tomcat log directory and execute the command: CD / usr / local / Tomcat / logs

2) Check the catalina.out log in Tomcat

3) View log execute command:

① Tail command: view the end of the text;

tail catalina.out,查看文本catalina.out;

Tail – 5 catalina.out, view the last 5 lines of text;

Tail – F catalina.out to view the real-time updated content of the text;

② Less command: display the text content according to the page;

less catalina.out

Pageup page up (page up)

Pagedown page down

↑ turn up one line

↓ turn down one line

/Keyword drill down on the character

? Keyword searches up for the character

Q exit (similar to quit exit)

③ More command: less is similar to more and displays text content according to the page;

more catalina.out

The space bar represents turning down the page (turning down the whole page)

Enter scroll down one line

/Keyword drill down on the character

B rollback

Q leave

4) View Keywords:

/Keyword drill down on the character

? Keyword searches up for the character

5) Page and line turning:

Pageup page up

Pagedown, space bar to turn down one page

↑, n turn up one line

↓, enter turn down one line

6) End viewing current log:

Q (similar to quit)

3、

4、   An application named “promotion” is published on the application server. The publishing directory is / home / promotion / Apache Tomcat / webapps /.

(1)   Do you know any methods to judge whether the application is running?   ps -ef|grep

(2)   How do you know the port information published by the application? losf -i

5、   The database table employee contains employee_ id,   employee_ name,   depart_ id,   depart_ name,   Salary field, please write out the SQL statement

(1) Sort by department string order to query the average salary of employees in each department (excluding “HR” Department)

(2) Query the name and employee number of each employee in the Department where “Zhang San” is located

1、SELECT depart_name, AVG(wage)

FROM employee

WHERE depart_name <> ‘HR’;

2、select employee_name, depart_id from student where employee_name=张三

6、   Are you proficient in using JMeter for interface testing and performance testing?

(1) What preprocessors and postprocessors have you used in scripting? Please introduce their usage scenarios. Preprocessor: read the document variable and set the environment variable

Post processor: assertions

(2) User defined variables in JMeter (user   Defined variables and user parameters   What is the difference between parameters?

difference:

(1)User   Defined variables import documents, tables, and user parameters are added directly

(3) Please list the performance test indicators you know.

Performance test index:

Response time, throughput, TPS, number of transactions, CPU, network, memory, I / O, hits, hits

(4) Please describe the relationship between response time and throughput in performance test.

Response time is one of the most important indexes of a system. Its value directly reflects the speed of the system. Response time refers to the total time taken to execute a request from the beginning to the last receipt of response data.

Response time = network transmission time of initiating request + server processing time + network transmission time of returning response

Throughput: number of requests processed per unit time (transactions / s) (measuring network)

Throughput refers to the number of requests that the system can process per unit time, reflecting the system’s ability to process requests, which is the most commonly used performance test index at present.

Differences: 1. The response time is the result time of processing  , Throughput: processing capacity

7、   Please design corresponding interface test cases according to the following interface specifications and business process description

getPaperBookList请求参数

参数名称

是否必须

类型

默认值

描述

queryWord

true

string

 

搜索词

goodsTypeId

false

string

1503

商品类型ID,过滤用。目前只有纸书类型1503,后续会增加,默认1503

pageSize

false

string

5

页长默认5

pageNo

false

string

1

页码,默认1

< strong > parameter name < / strong >

< strong > must I < / strong >

类型

< strong > default value < / strong >

描述

queryWord

true

string

Search term

goodsTypeId

false

string

one thousand five hundred and three

Commodity type ID, for filtering. At present, there is only paper book type 1503, which will be added later. The default is 1503

pageSize

false

string

five

Page length, default 5

pageNo

false

string

one

Page number, default 1

getPaperBookList响应数据

参数名称

是否必须

数据类型

描述

hasNext

true

boolean

是否有下一页

totalCount

true

number

按类型搜索结果的总数量

paperBookList

false

array[object]

搜索结果集

   id

true

string

商品id

   image

true

string

封面

   name

true

string

书名

   authorName

true

string

作者

   cpMark

true

string

来源供应商

   price

true

number

价格

< strong > parameter name < / strong >

< strong > must I < / strong >

< strong > data type < / strong >

描述

hasNext

true

boolean

Next page

totalCount

true

number

Total number of search results by type

paperBookList

false

array[object]

Search result set

id

true

string

Commodity ID

image

true

string

cover

name

true

string

title

   authorName

true

string

author

cpMark

true

string

Source supplier

price

true

number

Price

getPaperBookList接口流程描述:

l   if   (queryword is empty) the error code 22003 is returned

l   Enter the parameter according to the request (the default value of pageno is 1, the default value of PageSize is 5, and the default value of goodstypeid is 1503), and take the cache key = paperbook_ {queryWord}_ {goodsTypeId}_ Info, the return value is object a

  • (A == IS_NULL) 返回成功响应,hasNext=false,totalCount=0
  • (a = = paper book cache object), page the book object list in a according to pageno and PageSize, and return the successful response and the result after paging
  • (a = = null) http interface of book city, and the result is object B;

(1) If (b = = null), save is_ Null invalid cache, return successful response, hasnext = false, totalcount = 0

(2) Else: filter B according to the input parameter goodstypeid to get Object C; Put the result c into the cache; Paginate the book object list in C according to the input parameters pageno and PageSize, and return a successful response and paginated results

getPaperBookList接口流程图

ym_001

getPaperBookList获取页面列表接口

获取页面列表接口成功

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  B ==NULL

queryWord:狼图腾
goodsTypeId:1503
pageSize:5
pageNo:1

hasNext:1
totalCount:5
paperBookList:
   id:001
   image:bf
   name:狼图腾
   authorName:狼
   cpMark:A
   price:20

ym_002

获取页面列表接口__搜索词为空

 

queryWord: 空
goodsTypeId:1503
pageSize:5
pageNo:1

msg:2003

ym_002

获取页面列表接口__缓存为空 请求成功

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  为空

queryWord: 书名
goodsTypeId:1503
pageSize:5
pageNo:1

hasNext:false
totalCount:0

ym_003

获取页面列表接口__缓存存在——分页 请求成功

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  ==纸质书缓存对象

queryWord: 书名
goodsTypeId:1503
pageSize:5
pageNo:1

hasNext: true
totalCount:20
paperBookList:
   id:商品id
   image:
   name:
   authorName:
   cpMark:A
   price:

 

获取页面列表接口__缓存为null 分页

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  ==null

queryWord: 书名
goodsTypeId:1503
pageSize:5
pageNo:1

hasNext:
totalCount:
paperBookList:
   id:001
   image:bf
   name:狼图腾
   authorName:狼
   cpMark:B
   price:20

 

获取页面列表接口__

 

 

hasNext:FALSE
totalCount:0
paperBookList:
   id:001
   image:bf
   name:狼图腾
   authorName:狼
   cpMark:B
   price:20

ym_001

Getpaperbooklist get page list interface

Get page list interface succeeded

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  B ==NULL

queryWord:狼图腾goodsTypeId:1503pageSize:5pageNo:1

hasNext:1totalCount:5paperBookList:   id:001   image:bf   name:狼图腾   authorName:狼   cpMark:A   price:20

ym_002

Get page list interface__ Search term is empty

queryWord: 空goodsTypeId:1503pageSize:5pageNo:1

msg:2003

ym_002

Get page list interface__ The cache is empty. The request succeeded

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  为空

queryWord: 书名goodsTypeId:1503pageSize:5pageNo:1

hasNext:falsetotalCount:0

ym_003

Get page list interface__ Cache present – paging request succeeded

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  ==纸质书缓存对象

queryWord: 书名goodsTypeId:1503pageSize:5pageNo:1

hasNext: truetotalCount:20paperBookList:   id:商品id   image:   name:   authorName:   cpMark:A   price:

Get page list interface__ Cache is null paging

KEY=PAPERBOOK_{queryWord}_{goodsTypeId}_INFO  ==null

queryWord: 书名goodsTypeId:1503pageSize:5pageNo:1

hasNext:totalCount:paperBookList:   id:001   image:bf   name:狼图腾   authorName:狼   cpMark:B   price:20

Get page list interface__

hasNext:FALSEtotalCount:0paperBookList:   id:001   image:bf   name:狼图腾   authorName:狼   cpMark:B   price:20