食源送系统项目的测试
创始人
2024-11-15 18:03:28
0

一、对整个系统编写测试用例

        功能测试

        

       

        性能测试

                兼容性测试

                易用性测试

 

        安全测试

二、接口测试

        针对接口的功能测试,也就是检验接口是否按照接口文档输入输出

        2.1 使用Postman发送HTTP请求

        

        2.2 使用Java + TestNG 编写自动化测试用例

                登录界面功能

package com.sky.test;  import org.junit.jupiter.api.Order; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.edge.EdgeDriver; import org.openqa.selenium.edge.EdgeOptions; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeSuite; import org.testng.annotations.Test;  import java.util.concurrent.TimeUnit; public class LoginAndOut {     public  static WebDriver driver;       @BeforeClass     @Order(1)     public void openBrowser(){         System.setProperty("webdriver.edge.driver" , "D:/EdgeDriver/msedgedriver.exe");         //打开浏览器         EdgeOptions options = new EdgeOptions();         options.addArguments("--remote-allow-origins=*");         driver = new EdgeDriver(options);         System.out.println(driver);         driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);     }      /**      * 登录,登出      * @throws InterruptedException      */     @org.testng.annotations.Test     @Order(2)     public void Login() throws InterruptedException { //        driver = new E;         driver.get("http://www.localhost:81");         driver.manage().window().maximize();         driver.findElement(By.xpath("//input[@placeholder='账号']")).clear();         driver.findElement(By.xpath("//input[@placeholder='账号']")).sendKeys("admin");         Thread.sleep(1000);         driver.findElement(By.xpath("//input[@placeholder='密码']")).clear();         driver.findElement(By.xpath("//input[@placeholder='密码']")).sendKeys("123456");         Thread.sleep(1000);         driver.findElement(By.xpath("//span[text()='登录']")).click();         Thread.sleep(1000);         driver.findElement(By.xpath("/html/body/div[2]/div/div[2]")).click();         driver.findElement(By.xpath("//span[contains(text(),'管理员')]")).click();         Thread.sleep(2000);         driver.findElement(By.xpath("//div[@class='userList']/p[@class='outLogin']")).click();          Thread.sleep(1000);         driver.findElement(By.xpath("//span[text()='登录']")).click();     }  } 

        添加菜品功能

package com.sky.test; import net.sf.jsqlparser.statement.select.KSQLWindow; import org.junit.jupiter.api.Order; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.edge.EdgeDriver;  import org.openqa.selenium.edge.EdgeOptions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test;  import java.util.concurrent.TimeUnit;  public class homepage {      public WebDriver driver;       @BeforeClass     public void openBrowser() {         driver = LoginAndOut.driver;     }      /**      * 登录-菜品管理-添加菜品      */     @Test     @Order(3)     public void saveDish() throws InterruptedException {         driver.findElement(By.xpath("//div/a[@href='#/dish']")).click();         driver.findElement(By.xpath("//*[@id=\"app\"]/div/div[2]/section/div/div/div[1]/div[4]/button/span")).click();         driver.findElement(By.xpath("//input[@placeholder='请填写菜品名称']")).clear();         Thread.sleep(1000);         driver.findElement(By.xpath("//input[@placeholder='请填写菜品名称']")).sendKeys("selenium");         driver.findElement(By.xpath("//input[@placeholder='请设置菜品价格']")).clear();         Thread.sleep(1000);         driver.findElement(By.xpath("//input[@placeholder='请设置菜品价格']")).sendKeys("888");         driver.findElement(By.xpath("//input[@placeholder='请选择菜品分类']")).click();         Thread.sleep(1000);         WebElement element = driver.findElement(By.xpath("//ul[@class='el-scrollbar__view el-select-dropdown__list']"));         driver.findElement(By.xpath("//ul[@class='el-scrollbar__view el-select-dropdown__list']/li/span")).click();         driver.findElement(By.xpath("//span[@class='addBut']")).click();         driver.findElement(By.xpath("//input[@placeholder='请选择口味']")).click();         driver.findElement(By.xpath("//input[@name='file']")).sendKeys("C:\\Users\\FK\\Desktop\\HTML+CSS+JavaScript\\fengjing1.jpg");         driver.findElement(By.xpath("//textarea")).sendKeys("haochi");         driver.findElement(By.xpath("//span[contains(text(), '保存')]")).click();     }  }    

        生成对应类的xml文件,指定每个test(测试类)的执行顺序,顺序完成操作

相关内容

热门资讯

秒懂普及”新七喜大厅房卡购买“... 秒懂普及”新七喜大厅房卡购买“牛牛房卡是怎么购买的 微信牛牛房卡客服微信号微信游戏中心打开微信,添加...
秒懂教程!我买拼三张房卡链接,... 拼三张是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:71319951许多玩家在游戏中会购买房卡来享...
实测分享”皇豪互娱房卡充值“金... 实测分享”皇豪互娱房卡充值“金花牛牛房卡充值游戏中心打开微信,添加客服【113857776】,进入游...
正版授权“可以一起创房的牛牛,... 九尾大厅是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:160470940许多玩家在游戏中会购买房卡...
分享经验”神盾大新获取房卡教程... 分享经验”神盾大新获取房卡教程“卡农大厅房卡充值游戏中心打开微信,添加客服【113857776】,进...
秒懂教程!微信牛牛房卡如何购买... 牛牛是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:66336574许多玩家在游戏中会购买房卡来享受...
1分秒分析”海贝之城哪里买低价... 来教大家如何使用哪里有详细房卡介绍房卡充值 添加房卡批售商:微【113857775】复制到微信搜索、...
ia实测“在哪里买炸金花房卡便... 天王大厅是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:15984933许多玩家在游戏中会购买房卡来...
实测教程”鲨鱼众娱怎么买房卡“... 实测教程”鲨鱼众娱怎么买房卡“王者大厅房间卡怎么购买游戏中心打开微信,添加客服【113857776】...
秒懂教程!微信买链接牛牛房卡,... 斗牛是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:56001354许多玩家在游戏中会购买房卡来享受...
秒懂教程!微信金花房间卡在哪买... 金花是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:71319951许多玩家在游戏中会购买房卡来享受...
ia实测“微信斗牛房卡专卖店联... 金牛座金花是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:86909166许多玩家在游戏中会购买房卡...
1分秒分析”百万牛房卡客服“拼... 房卡客服是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:113857776许多玩家在游戏中会购买房卡...
一分钟实测分享”海贝之城房卡获... 一分钟实测分享”海贝之城房卡获取方式“金花房卡充值游戏中心打开微信,添加客服【113857776】,...
秒懂教程!拼三张房卡哪里买,新... 拼三张是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:66336574许多玩家在游戏中会购买房卡来享...
一分钟了解“哪里购买斗牛牛链接... 斗牛是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:15984933许多玩家在游戏中会购买房卡来享受...
秒懂普及”新竹大厅在哪里买房卡... 第二也可以在游戏内商城:在游戏界面中找到 “微信金花,斗牛链接房卡”“商城”选项,选择房卡的购买选项...
玩家攻略”新大海房卡获取方式“... 玩家攻略”新大海房卡获取方式“详细房卡使用教程 微信牛牛房卡客服微信号微信游戏中心打开微信,添加客服...
秒懂教程!微信牛牛房卡怎样开,... 斗牛是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:56001354许多玩家在游戏中会购买房卡来享受...
实测教程”贝塔大厅是如何购买的... 第二也可以在游戏内商城:在游戏界面中找到 “微信金花,斗牛链接房卡”“商城”选项,选择房卡的购买选项...