软件测试工程师 岗位 面试题设计的题型 有
软件测试基本理论、
性能测试(压测、并发、吞吐)、
Linux 运维(资源监控、进程唤醒、日志查看的指令和设计脚本)、
接口测试(Http Get 压测、Post 压测)、
SQL 性能优化(sql 语句编写、函数设计、存储过程设计),
JAVA(方法重载重写的区别、抽象类与接口的区别)
1、【Linux 命令】使用Shell或其他脚本语言编写一个针对Linux进程监控及故障重启的脚本
准备 : ps -ef |grep 指令 是检查 进程是否正在运行 、
#/bin/sh
stillrunning = $(ps -ef|grep 路径名/进程名 | grep -v "grep")
if["stillrunning"] ; then
ehco "进程正在运行,杀死并使用此脚本重启"
kill -9 $pidof 进程名
else
路径/进程名 start
fi
done
2、【接口测试】请使用Python/JAVA写一个脚本,对接口 http://abc.com/api/test 进行Get方法模拟压测,可使用所有模块
/**
* 目标:编写一段代码,模拟并发请求为20,且总的请求数为1000,当1000个请求完成后,打印“请求完成”
*/
@Slf4j
public class TestConcurrentRequest {
// 总的请求个数
public static final int requestTotal = 1000;
// 同一时刻最大的并发线程的个数
public static final int concurrentThreadNum = 20;
public static void main(String[] args) throws InterruptedException {
ExecutorService executorService = Executors.newCachedThreadPool();
CountDownLatch countDownLatch = new CountDownLatch(requestTotal);
Semaphore semaphore = new Semaphore(concurrentThreadNum);
for (int i = 0; i< requestTotal; i++) {
executorService.execute(()->{
try {
semaphore.acquire();
String result = testRequestUri();
log.info("result:{}.", result);
semaphore.release();
} catch (InterruptedException e) {
log.error("exception", e);
}
countDownLatch.countDown();
});
}
countDownLatch.await();
executorService.shutdown();
log.info("请求完成");
}
private static String testRequestUri() {
return HttpClientUtil.get("http://localhost:8080/test");
}
}
3、【正则表达式】
4、【性能压力测试】性能压测的过程中,你觉得要完成的最关键的关注点是什么?说明理由。
客户端:
1)用户操作动作的请求等待时间
2)资源加载速度
3)弱网软件稳定性
4)不同系统、硬件平台软件效果
服务器端:
1)服务器处理请求响应时间