食源送系统项目的测试
创始人
2024-11-15 17:39:01
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(测试类)的执行顺序,顺序完成操作

相关内容

热门资讯

太嚣张了!心悦app辅助工具,... 太嚣张了!心悦app辅助工具,德普之星有透视辅助吗(透视)开挂辅助插件(确实有挂)《详细加薇1367...
通报辅助!新天道辅助软件怎么样... 通报辅助!新天道辅助软件怎么样,衢州都莱有没有挂(今日百科开挂辅助脚本)>>您好:软件加136704...
太无语了!福建天天开心辅助器是... 福建天天开心辅助器是真的吗是一款可以让一直输的玩家,快速成为一个“必胜”的ai辅助神器,有需要的用户...
发现开挂!超圣大厅黑科技,wp... 发现开挂!超圣大厅黑科技,wpk辅助器(一起来讨论开挂辅助脚本)您好:超圣大厅黑科技这款游戏可以开挂...
太离谱了!微信蜀山四川修改器先... 大家好,今天小编来为大家解答微信蜀山四川修改器先测试这个问题咨询软件客服可以免费测试直接加微信(13...
必看辅助!财神十三张脚本辅助,... 柚子联盟辅助器下载是一款可以让一直输的玩家,快速成为一个“必胜”的ai辅助神器,有需要的用户可以加我...
太嚣张了!多乐找刺激捕鱼辅助,... 太嚣张了!多乐找刺激捕鱼辅助,wejoker辅助软件视频(透视)开挂辅助软件(有挂详情);无需打开直...
传授开挂!新518互游脚本,科... 科乐天天踢有没有挂作弊是一款专注玩家量身打造的游戏记牌类型软件,在科乐天天踢有没有挂作弊这款游戏中我...
太实锤了!微乐家乡自建房辅助a... 太实锤了!微乐家乡自建房辅助app,购买wepoker模拟器(透视)开挂辅助脚本(有挂秘笈);无需打...
推荐辅助!广东雀神智能插件安装... 推荐辅助!广东雀神智能插件安装包,欢乐达人暗堡辅助(玩家必看攻略开挂辅助工具);无需打开直接搜索加薇...