当前位置:网站首页>Picture server project test
Picture server project test
2022-07-01 06:20:00 【qq_ fifty-two million twenty-five thousand two hundred and eight】
1. Write test cases and execute 
According to the development stage
Project test sequence :
unit testing —— A functional test —— automated testing , Performance testing
2. unit testing
public class ImageDAOTest {
@Test
public void queryCountByMd5() {
ImageDAO imageDAO = new ImageDAO();
int n = imageDAO.queryCountByMd5("123123");
assertEquals(1,n);
}
@Test
public void insert() {
ImageDAO imageDAO = new ImageDAO();
Image image = new Image();
image.setImageName("");
image.setSize((long)44189);
image.setUploadTime("2021-07-01 12:42:10");
image.setMd5("71f7b259105fc5d3b86826945daff728");
image.setContentType("image/jpeg");
image.setPath("/71f7b259105fc5d3b86826945daff728");
imageDAO.insert(image);
}
@Test
public void queryAllImage() {
ImageDAO imageDAO = new ImageDAO();
List<Image> list = new ArrayList<>();
list = imageDAO.queryAllImage();
System.out.println(list.size());
for(Image image : list) {
System.out.println(image.getImageName());
}
}
@Test
public void queryOneImage() {
ImageDAO imageDAO = new ImageDAO();
Image image = imageDAO.queryOneImage(0);
System.out.println(image);
}
@Test
public void delete() {
ImageDAO imageDAO = new ImageDAO();
int n = imageDAO.delete(24);
System.out.println(n);
}
}
3. Performance testing
Adopted Loadrunner A three piece set of , First use Virtual User Generator Recording script , Reuse Controller Simulate the virtual user to simply test the load pressure , The last generation Analysis Report for analysis .

4. automated testing
Here we use selenium and unittest Completed automated testing . Write scripts that simply upload and delete images .
from selenium import webdriver
import unittest
import time
class imageTest(unittest.TestCase):
def setUp(self):
self.driver=webdriver.Chrome()
self.driver.get("http://127.0.0.1:8080/java_image_server/index.html")
self.driver.maximize_window()
time.sleep(3)
def tesrDown(self):
self.driver.quit()
# Upload
# @unittest.skip("skipping")
def test_upload(self):
self.driver.find_element_by_id("upload").send_keys("E:\\06.jpg")
time.sleep(6)
self.driver.find_element_by_xpath("//*[@id='blog-collapse']/form/div[2]/input").click()
time.sleep(6)
# Delete
# @unittest.skip("skipping")
def test_delete(self):
self.driver.find_element_by_xpath("//*[@id='container']/div[1]/button").click()
time.sleep(3)
alert=self.driver.switch_to.alert
alert.accept()
time.sleep(3)
if __name__=="__main__":
unittest.main()
边栏推荐
- SystemVerilog learning-07-class inheritance and package use
- 异常检测方法梳理,看这篇就够了!
- 端口扫描工具是什么?端口扫描工具有什么用
- [postgraduate entrance examination advanced mathematics Wu Zhongxiang +880 version for personal use] advanced mathematics Chapter II Basic Stage mind map
- Thoughts on a "01 knapsack problem" expansion problem
- Pla ne colle pas sur le lit: 6 solutions simples
- 【ITSM】什么是ITSM,IT部门为什么需要ITSM
- pycharm 配置jupyter
- Skywalking integrated Nacos dynamic configuration
- 蚂蚁新村田头村变甜头村 让厦门灌口镇田头村变甜头村的特色农产品之一是
猜你喜欢

Discrimination between left and right limits of derivatives and left and right derivatives
![[note] e-commerce order data analysis practice](/img/03/367756437be947b5b995d5f7f55236.png)
[note] e-commerce order data analysis practice

Skywalking integrated Nacos dynamic configuration

2022 年面向初学者的 10 大免费 3D 建模软件

Understanding of C manualresetevent class

分布式锁实现

Essay learning record essay multi label Global

Tidb database characteristics summary

Fixed height of the first column in El table dynamic header rendering

无限水平大理石游戏
随机推荐
Oracle create user + Role
Although pycharm is marked with red in the run-time search path, it does not affect the execution of the program
Diffusion (multi-source search)
端口扫描工具是什么?端口扫描工具有什么用
DEV XPO对比之XAF BO
Database problems, how to optimize Oracle SQL query statements faster and more efficient
Freeswitch dial the extension number
SOE spatial analysis server MySQL and PostGIS geospatial database of Postgres anti injection attack
让厦门灌口镇田头村变甜头村的特色农产品之一是蚂蚁新村
UOW of dev XPO comparison
Index method and random forest to realize the information of surface water body in wet season in Shandong Province
解决麒麟V10上传文件乱码问题
可动的机械挂钟
LED lighting used in health lighting
Distributed lock implementation
68 cesium code datasource loading czml
【文件系统】如何在ubi之上运行squashfs
Kubedm builds kubenetes cluster (Personal Learning version)
MySQL中 in 和 exists 的区别
XAF Bo of dev XPO comparison