当前位置:网站首页>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()
边栏推荐
- c# Xml帮助类
- Elements of database ER diagram
- Recueillir des trésors dans le palais souterrain (recherche de mémoire profonde)
- DHT11 温湿度传感器
- SOE spatial analysis server MySQL and PostGIS geospatial database of Postgres anti injection attack
- [postgraduate entrance examination advanced mathematics Wu Zhongxiang +880 version for personal use] advanced mathematics Chapter II Basic Stage mind map
- 高阶-二叉平衡树
- 浅谈SIEM
- HCM Beginner (III) - quickly enter pa70 and pa71 to browse employee information PA10
- 【ManageEngine】如何实现网络自动化运维
猜你喜欢

Thesis learning record essay multi label lift

3D printer threading: five simple solutions

MongoDB:一、MongoDB是什么?MongoDB的优缺点

HCM Beginner (II) - information type

解决麒麟V10上传文件乱码问题

Essay learning record essay multi label Global

Understanding of C manualresetevent class

The row and column numbers of each pixel of multi-source grid data in the same area are the same, that is, the number of rows and columns are the same, and the pixel size is the same

Distributed lock implementation

让田头村变甜头村的特色农产品是仙景芋还是白菜
随机推荐
To sort out the anomaly detection methods, just read this article!
Essay learning record essay multi label Global
HCM Beginner (III) - quickly enter pa70 and pa71 to browse employee information PA10
Flink实战--多流合并
Movable mechanical wall clock
jdbc 数据库操作
Minio error correction code, construction and startup of distributed Minio cluster
【ManageEngine卓豪】移动终端管理解决方案,助力中州航空产业数字化转型
C XML help class
The row and column numbers of each pixel of multi-source grid data in the same area are the same, that is, the number of rows and columns are the same, and the pixel size is the same
Distributed lock implementation
Uniapp tree level selector
图片服务器项目测试
JMM详解
2022 年面向初学者的 10 大免费 3D 建模软件
PLA不粘贴在床上:6个简单的解决方案
DEV XPO对比之XAF BO
HDU - 1501 zipper (memory deep search)
How does MySQL store Emoji?
连续四年入选Gartner魔力象限,ManageEngine卓豪是如何做到的?