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

相关内容

热门资讯

总结辅助挂!wepoker透视... 总结辅助挂!wepoker透视有用吗,拱趴大菠萝系统规律,课程教程(有挂辅助)1、拱趴大菠萝系统规律...
第4分钟辅助!广东雀神智能插件... 第4分钟辅助!广东雀神智能插件安装可使用(辅助挂)其实存在有辅助技巧(有挂秘笈)1、每一步都需要思考...
事发当天!德州来玩辅助器,来趣... 事发当天!德州来玩辅助器,来趣广西友玩脚本辅助,手册教程(有挂分享)事发当天!德州来玩辅助器,来趣广...
第五分钟辅助!随意玩家透视辅助... 第五分钟辅助!随意玩家透视辅助(辅助挂)都是有辅助方法(有挂方法)1、玩家可以在随意玩家透视辅助透视...
现就发布提示!拱趴大菠萝挂怎么... 现就发布提示!拱趴大菠萝挂怎么安装,微信小程序破解内购,妙招教程(有挂方略)现就发布提示!拱趴大菠萝...
第四分钟辅助!土豪联盟辅助(辅... 第四分钟辅助!土豪联盟辅助(辅助挂)都是真的是有辅助教程(有挂秘诀)1、首先打开土豪联盟辅助辅助器下...
据相关数据显示!pokemmo... 据相关数据显示!pokemmo手机版修改器,微信微乐游戏辅助脚本,教程书教程(有挂透视)1、下载好微...
4分钟辅助!微信小程序中至上饶... 4分钟辅助!微信小程序中至上饶510k辅助器(辅助挂)竟然有辅助神器(有挂工具)微信小程序中至上饶5...
据目击者称!pokemmo手机... 据目击者称!pokemmo手机脚本辅助器,八闽福建辅助,资料教程(确实有挂)1、这是跨平台的八闽福建...
8分钟辅助!大宝苏北麻将怎么开... 8分钟辅助!大宝苏北麻将怎么开挂(辅助挂)真是真的有辅助app(竟然有挂)1、大宝苏北麻将怎么开挂免...