如何評估測試人員績效
posted @ 2014-09-18 10:03 順其自然EVO 閱讀(202) | 評論 (0) | 編輯 收藏
blog已經轉移至github,大家請訪問 http://qaseven.github.io/
posted @ 2014-09-18 10:03 順其自然EVO 閱讀(202) | 評論 (0) | 編輯 收藏
posted @ 2014-09-18 09:56 順其自然EVO 閱讀(481) | 評論 (0) | 編輯 收藏
<?xmlversion='1.0'encoding='UTF-8'?> <soapenv:Envelopexmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:q0="http://ws.apache.org/axis2"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <q0:sayHello> <args0>pengyusong</args0> </q0:sayHello> </soapenv:Body> </soapenv:Envelope> |
<testcasesrepeat="1"> <case id="1" description1="WebServicesSample-HelloWorld" url="http://localhost:8080/axis2/services/HelloWorld?wsdl" method="post" posttype="text/xml" postbody="file=>doGoogleSearch.xml" verifypositive="\<return>Hello,mynameispengyusong\</return>" /> </testcases> |
------------------------------------------------------- Test:test_google.xml-1 WebServicesSample-GoogleSearchAPI Verify:"Hello,mynameispengyusong" PassedXMLParser(contentiswell-formed) PassedPositiveVerification PassedHTTPResponseCodeVerification(notinerrorrange) TESTCASEPASSED ResponseTime=0.015sec ------------------------------------------------------- StartTime:WedOct3016:46:342013 TotalRunTime:0.409seconds TestCasesRun:1 TestCasesPassed:1 TestCasesFailed:0 VerificationsPassed:3 VerificationsFailed:0 AverageResponseTime:0.015seconds MaxResponseTime:0.015seconds MinResponseTime:0.015seconds |
posted @ 2014-09-18 09:31 順其自然EVO 閱讀(229) | 評論 (0) | 編輯 收藏
posted @ 2014-09-18 09:30 順其自然EVO 閱讀(4756) | 評論 (0) | 編輯 收藏
package baidu; import java.io.File; import java.io.IOException; import java.util.List; import org.apache.commons.io.FileUtils; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; //import org.openqa.selenium.WebDriver.Navigation; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Actions; public class selenium { public static void snapshot(TakesScreenshot drivername, String filename) { // this method will take screen shot ,require two parameters ,one is driver name, another is file name File scrFile = drivername.getScreenshotAs(OutputType.FILE); // Now you can do whatever you need to do with it, for example copy somewhere try { System.out.println("save snapshot path is:E:/"+filename); FileUtils.copyFile(scrFile, new File("E:\\"+filename)); } catch (IOException e) { // TODO Auto-generated catch block System.out.println("Can't save screenshot"); e.printStackTrace(); } finally { System.out.println("screen shot finished"); } } public static void main (String [] args) throws InterruptedException { String URL="http://61.135.169.105/"; //avoid Chrome warnning message like "unsupported command-line flag --ignore-certificate-errors. " ChromeOptions options = new ChromeOptions(); options.addArguments("--test-type"); System.setProperty("webdriver.chrome.driver", "D:\\selenium\\chromedriver.exe"); WebDriver driver = new ChromeDriver(options); driver.get(URL); //max size the browser driver.manage().window().maximize(); /* Navigation navigation = driver.navigate(); navigation.to(URL);*/ Thread.sleep(2000); snapshot((TakesScreenshot)driver,"open_baidu.png"); //WebElement reg=driver.findElement(By.name("tj_reg")); //reg.click(); // WebElement keyWord = driver.findElement(By.id("kw1")); //find the element WebElement keyWord = driver.findElement(By.xpath("http://input[@id='kw1']")); keyWord.clear(); //send key words keyWord.sendKeys("小蘋果"); Thread.sleep(3000); snapshot((TakesScreenshot)driver,"input_keyWord.png"); WebElement submit = driver.findElement(By.id("su1")); System.out.println(submit.getLocation()); submit.click(); //System.out.println(driver.getWindowHandle()); Thread.sleep(5000); WebElement se=driver.findElement(By.xpath("http://*[@id=\"2\"]/div[1]/div[2]/table/tbody/tr/td[5]/span/a")) ; Actions action = new Actions(driver); action.clickAndHold(se); action.sendKeys(Keys.DOWN); Thread.sleep(5000); List<WebElement> elementList = driver.findElements(By.tagName("herf")); for(WebElement e:elementList) { System.out.print("-->"+e.getText()); } //se.click(); // System.out.println(driver.getPageSource()); // System.out.println(pageSource); //WebElement link =driver.findElement(By.xpath(SELENIUM_LINK)); WebElement link =driver.findElement(By.xpath("http://*[@id=\"2\"]/div[1]/div[2]/table/tbody/tr/td[5]/span/a"));//By.xpath("http://*[@id=\"1\"]/h3/a")); //*[@id="1"]/h3/a link.click(); Thread.sleep(5000); driver.switchTo().window(driver.getWindowHandles().toArray(new String[0])[1]); Thread.sleep(5000); WebElement down =driver.findElement(By.xpath("http://*[@id=\"128\"]"));//<i class="icon btn-icon-download-small"></i> Thread.sleep(5000); down.click(); snapshot((TakesScreenshot)driver,"down_m.png"); //get page title System.out.println(driver.getTitle()); Thread.sleep(5000); WebElement userName=driver.findElement(By.id("TANGRAM__PSP_8__userName")); WebElement password=driver.findElement(By.id("TANGRAM__PSP_8__password")); WebElement login=driver.findElement(By.id("TANGRAM__PSP_8__submit")); Thread.sleep(5000); userName.sendKeys("QAtest");//your baidu userName password.sendKeys("mypassword");//your baidu password login.submit(); // navigation.back(); snapshot((TakesScreenshot)driver,"open_bake.png"); System.out.println(driver.getTitle()+"\n"+driver.getCurrentUrl()); Thread.sleep(50000); File file=new File("C:\\Users\\Young\\Downloads\\小蘋果.mp3"); if(file.exists()) { System.out.println("PASS"); } else { System.out.println("FAIL"); } driver.quit(); } } |
English » |
posted @ 2014-09-18 09:28 順其自然EVO 閱讀(337) | 評論 (0) | 編輯 收藏
posted @ 2014-09-18 09:26 順其自然EVO 閱讀(162) | 評論 (0) | 編輯 收藏
English » |
import os,sys; path = sys.path[0] os.chdir(path) encode_list = 'encode_list.txt' result = path + '\\results' def get_encode(): encode_file = open(path + '\\'+ encode_list) encode = dict() for line in encode_file: if line!='\n' and len(line) >1: if line.find('read me') <0: encode[line[1:].strip()] = line[0] return encode def get_files(): files = os.listdir(path) file_list = list() for file in files: if file.endswith('.txt') and file!= encode_list: file_list.append(file) return file_list def relace_url_encode(strPri,dicEncode): items = dicEncode.items() for (key,value) in items: if strPri.find(key): strPri = strPri.replace(key,value) return strPri def create_result(): if not os.path.isdir(result): os.makedirs(result) def write_result(filePri,strText): fp = open(result+'\\'+filePri,'w+') fp.write(strText) fp.close() create_result() encode = get_encode() file_list = get_files() for ff in file_list: try: f = open(ff) text = f.read() finally: f.close() temp = relace_url_encode(text,encode) temp = temp.replace('&','\n') write_result(ff,temp) |
posted @ 2014-09-18 09:23 順其自然EVO 閱讀(524) | 評論 (0) | 編輯 收藏
#!/bin/sh weatherDateRoot=http://www.weather.com.cn/data/sk/101170101.html weatherDataFile=weather.html wget $weatherDateRoot -O $weatherDataFile > /dev/null 2>&1 sed 's/.*temp":"\([0-9]\{1,2\}\).*/\1/g' $weatherDataFile |
#!/bin/sh allDataUrl=http://www.weather.com.cn/data/cityinfo/101170101.html allDataFile=/home/snowsolf/shell/weather/allDay.html dataUrl=http://www.weather.com.cn/data/sk/101170101.html dataFile=/home/snowsolf/shell/weather/weather.html wget $dataUrl -O $dataFile > /dev/null 2>&1 wget $allDataUrl -O $allDataFile > /dev/null 2>&1 |
posted @ 2014-09-17 10:08 順其自然EVO 閱讀(262) | 評論 (0) | 編輯 收藏
posted @ 2014-09-17 10:07 順其自然EVO 閱讀(355) | 評論 (0) | 編輯 收藏
1 /** 2 * 根據BufferedImage獲取圖片RGB數組 3 * @param bfImage 4 * @return 5 */ 6 public static int[][] getImageGRB(BufferedImage bfImage) { 7 int width = bfImage.getWidth(); 8 int height = bfImage.getHeight(); 9 int[][] result = new int[height][width]; 10 for (int h = 0; h < height; h++) { 11 for (int w = 0; w < width; w++) { 12 //使用getRGB(w, h)獲取該點的顏色值是ARGB,而在實際應用中使用的是RGB,所以需要將ARGB轉化成RGB,即bufImg.getRGB(w, h) & 0xFFFFFF。 13 result[h][w] = bfImage.getRGB(w, h) & 0xFFFFFF; 14 } 15 } 16 return result; 17 } |
1 package com.jebysun.test.imagefind; 2 3 import java.awt.AWTException; 4 import java.awt.Rectangle; 5 import java.awt.Robot; 6 import java.awt.Toolkit; 7 import java.awt.image.BufferedImage; 8 import java.io.File; 9 import java.io.IOException; 10 11 import javax.imageio.ImageIO; 12 /** 13 * 屏幕上查找指定圖片 14 * @author Jeby Sun 15 * @date 2014-09-13 16 * @website http://www.jebysun.com 17 */ 18 public class ImageFindDemo { 19 20 BufferedImage screenShotImage; //屏幕截圖 21 BufferedImage keyImage; //查找目標圖片 22 23 int scrShotImgWidth; //屏幕截圖寬度 24 int scrShotImgHeight; //屏幕截圖高度 25 26 int keyImgWidth; //查找目標圖片寬度 27 int keyImgHeight; //查找目標圖片高度 28 29 int[][] screenShotImageRGBData; //屏幕截圖RGB數據 30 int[][] keyImageRGBData; //查找目標圖片RGB數據 31 32 int[][][] findImgData; //查找結果,目標圖標位于屏幕截圖上的坐標數據 33 34 35 public ImageFindDemo(String keyImagePath) { 36 screenShotImage = this.getFullScreenShot(); 37 keyImage = this.getBfImageFromPath(keyImagePath); 38 screenShotImageRGBData = this.getImageGRB(screenShotImage); 39 keyImageRGBData = this.getImageGRB(keyImage); 40 scrShotImgWidth = screenShotImage.getWidth(); 41 scrShotImgHeight = screenShotImage.getHeight(); 42 keyImgWidth = keyImage.getWidth(); 43 keyImgHeight = keyImage.getHeight(); 44 45 //開始查找 46 this.findImage(); 47 48 } 49 50 /** 51 * 全屏截圖 52 * @return 返回BufferedImage 53 */ 54 public BufferedImage getFullScreenShot() { 55 BufferedImage bfImage = null; 56 int width = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth(); 57 int height = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight(); 58 try { 59 Robot robot = new Robot(); 60 bfImage = robot.createScreenCapture(new Rectangle(0, 0, width, height)); 61 } catch (AWTException e) { 62 e.printStackTrace(); 63 } 64 return bfImage; 65 } 66 67 /** 68 * 從本地文件讀取目標圖片 69 * @param keyImagePath - 圖片絕對路徑 70 * @return 本地圖片的BufferedImage對象 71 */ 72 public BufferedImage getBfImageFromPath(String keyImagePath) { 73 BufferedImage bfImage = null; 74 try { 75 bfImage = ImageIO.read(new File(keyImagePath)); 76 } catch (IOException e) { 77 e.printStackTrace(); 78 } 79 return bfImage; 80 } 81 82 /** 83 * 根據BufferedImage獲取圖片RGB數組 84 * @param bfImage 85 * @return 86 */ 87 public int[][] getImageGRB(BufferedImage bfImage) { 88 int width = bfImage.getWidth(); 89 int height = bfImage.getHeight(); 90 int[][] result = new int[height][width]; 91 for (int h = 0; h < height; h++) { 92 for (int w = 0; w < width; w++) { 93 //使用getRGB(w, h)獲取該點的顏色值是ARGB,而在實際應用中使用的是RGB,所以需要將ARGB轉化成RGB,即bufImg.getRGB(w, h) & 0xFFFFFF。 94 result[h][w] = bfImage.getRGB(w, h) & 0xFFFFFF; 95 } 96 } 97 return result; 98 } 99 100 101 /** 102 * 查找圖片 103 */ 104 public void findImage() { 105 findImgData = new int[keyImgHeight][keyImgWidth][2]; 106 //遍歷屏幕截圖像素點數據 107 for(int y=0; y<scrShotImgHeight-keyImgHeight; y++) { 108 for(int x=0; x<scrShotImgWidth-keyImgWidth; x++) { 109 //根據目標圖的尺寸,得到目標圖四個角映射到屏幕截圖上的四個點, 110 //判斷截圖上對應的四個點與圖B的四個角像素點的值是否相同, 111 //如果相同就將屏幕截圖上映射范圍內的所有的點與目標圖的所有的點進行比較。 112 if((keyImageRGBData[0][0]^screenShotImageRGBData[y][x])==0 113 && (keyImageRGBData[0][keyImgWidth-1]^screenShotImageRGBData[y][x+keyImgWidth-1])==0 114 && (keyImageRGBData[keyImgHeight-1][keyImgWidth-1]^screenShotImageRGBData[y+keyImgHeight-1][x+keyImgWidth-1])==0 115 && (keyImageRGBData[keyImgHeight-1][0]^screenShotImageRGBData[y+keyImgHeight-1][x])==0) { 116 117 boolean isFinded = isMatchAll(y, x); 118 //如果比較結果完全相同,則說明圖片找到,填充查找到的位置坐標數據到查找結果數組。 119 if(isFinded) { 120 for(int h=0; h<keyImgHeight; h++) { 121 for(int w=0; w<keyImgWidth; w++) { 122 findImgData[h][w][0] = y+h; 123 findImgData[h][w][1] = x+w; 124 } 125 } 126 return; 127 } 128 } 129 } 130 } 131 } 132 133 /** 134 * 判斷屏幕截圖上目標圖映射范圍內的全部點是否全部和小圖的點一一對應。 135 * @param y - 與目標圖左上角像素點想匹配的屏幕截圖y坐標 136 * @param x - 與目標圖左上角像素點想匹配的屏幕截圖x坐標 137 * @return 138 */ 139 public boolean isMatchAll(int y, int x) { 140 int biggerY = 0; 141 int biggerX = 0; 142 int xor = 0; 143 for(int smallerY=0; smallerY<keyImgHeight; smallerY++) { 144 biggerY = y+smallerY; 145 for(int smallerX=0; smallerX<keyImgWidth; smallerX++) { 146 biggerX = x+smallerX; 147 if(biggerY>=scrShotImgHeight || biggerX>=scrShotImgWidth) { 148 return false; 149 } 150 xor = keyImageRGBData[smallerY][smallerX]^screenShotImageRGBData[biggerY][biggerX]; 151 if(xor!=0) { 152 return false; 153 } 154 } 155 biggerX = x; 156 } 157 return true; 158 } 159 160 /** 161 * 輸出查找到的坐標數據 162 */ 163 private void printFindData() { 164 for(int y=0; y<keyImgHeight; y++) { 165 for(int x=0; x<keyImgWidth; x++) { 166 System.out.print("("+this.findImgData[y][x][0]+", "+this.findImgData[y][x][1]+")"); 167 } 168 System.out.println(); 169 } 170 } 171 172 173 public static void main(String[] args) { 174 String keyImagePath = "D:/key.png"; 175 ImageFindDemo demo = new ImageFindDemo(keyImagePath); 176 demo.printFindData(); 177 } 178 179 } |
posted @ 2014-09-17 09:52 順其自然EVO 閱讀(727) | 評論 (0) | 編輯 收藏