當我們執行一個測試套件或測試用例?(在測試基於WSDL)如何執行測試套件
Q
如何執行測試套件
1
A
回答
0
至於如何從soapUI的一個Excel工作表基於報表時,產生通過soapUI的一個Excel工作表基於報告我知道在運行測試用例或測試套件後無法創建Excel報告。一種方法可能是創建DataSink
測試步驟,將數據接收器類型設置爲Excel,然後向其寫入多個屬性。
0
要將測試結果導出到Excel文件中,您需要在測試用例中創建一個常規步驟。
soapUI使用免費的Java Excel API來創建或處理Excel文件中的數據。
下面你可以找到基本的示例代碼。
import jxl.*;
import jxl.write.*;
// create an excel workbook
WritableWorkbook workbook1 = Workbook.createWorkbook(new File("c:\\report.xls"));
// create a sheet in the workbook
WritableSheet sheet1 = workbook1.createSheet("Report Worksheet", 0);
// Get the data to be added to the report
def fieldFromResponse = context.expand('${Test Request#Response#declare namespace soap=\'http://www.w3.org/2003/05/soap-envelope\'; //soap:Text[1]}');
// create a label
Label label = new Label(0, 0, fieldFromResponse);
// Add the label into the sheet
sheet1.addCell(label);
workbook1.write();
workbook1.close();
0
下面的代碼工作創建Excel文件,使用Java Excel的API來編寫表:
import jxl.*;
import jxl.write.*;
import java.io.*;
public class CreateExcel_JxlApi {
public static void main(String[] args) {
//create WorkbookSettings object
WorkbookSettings ws = new WorkbookSettings();
try{
//create work book
//WritableWorkbook workbook = Workbook.createWorkbook(new File("F:/Tips/JExcelTip/TestReport.xls"), ws);
WritableWorkbook workbook = Workbook.createWorkbook(new File("F:\\TestReport.xls"), ws);
System.out.println("Did excel file create?");
//create work sheet
WritableSheet workSheet = null;
workSheet = workbook.createSheet("Test Report" ,0);
SheetSettings sh = workSheet.getSettings();
//Creating Writable font to be used in the report
WritableFont normalFont = new WritableFont(WritableFont.createFont("MS Sans Serif"),
WritableFont.DEFAULT_POINT_SIZE,
WritableFont.NO_BOLD, false);
//creating plain format to write data in excel sheet
WritableCellFormat normalFormat = new WritableCellFormat(normalFont);
normalFormat.setWrap(true);
normalFormat.setAlignment(jxl.format.Alignment.CENTRE);
normalFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
normalFormat.setWrap(true);
normalFormat.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN,
jxl.format.Colour.BLACK);
//write to datasheet
workSheet.addCell(new jxl.write.Label(0,0,"User Name",normalFormat));
workSheet.addCell(new jxl.write.Label(1,0,"Password",normalFormat));
//write to the excel sheet
workbook.write();
//close the workbook
workbook.close();
}catch(Exception e){
e.printStackTrace();
}
}
}
0
import java.util.*;
import java.lang.*;
import jxl.*
import jxl.write.*
testCase = testRunner.testCase.testSuite.project.getTestSuiteByName('TS_CurrencyConverter').getTestCaseByName('TC_CurrencyConverter')
def properties = new com.eviware.soapui.support.types.StringToObjectMap()
def async = false
def runner=testCase.run (properties, async)
for(r in runner.results)
{
log.info(testCase.name+ ":Executed Successfully with Status " + r.status)
//testCase.name+ ":Executed Successfully with Status " + r.status
WritableWorkbook workbook1 = Workbook.createWorkbook(new File("c:/AQR/TestResult.xls"))
WritableSheet sheet1 = workbook1.createSheet("RunReport", 0)
Label TCNamelabel = new Label(0, 0, "Test Case Name");
Label TCStatus= new Label(1,0,"Test Case Status");
//Label TCComment= new Label(0,2,"Comment");
sheet1.addCell(TCNamelabel);
sheet1.addCell(TCStatus);
Label TCANamelabel = new Label(0, 1, testCase.name);
Label TCAStatus= new Label(1, 1, ""+ r.status);
sheet1.addCell(TCANamelabel);
sheet1.addCell(TCAStatus);
workbook1.write()
workbook1.close()
}
相關問題
- 1. Fitnesse套件未能執行測試
- 2. 使用Jenkins執行HTML測試套件
- 3. 如何在eclipse中只執行測試並忽略測試套件?
- 4. 從Python unittest測試套件執行特定測試?
- 5. 如何導出(JUnit的)測試套件爲可執行的JAR
- 6. 如何執行boost.test庫中的指定測試套件
- 7. 如何以編程方式使用JUnit4執行測試套件?
- 8. 如何運行世博測試套件
- 9. 如何在執行另一個測試後執行測試?
- 10. Python套件測試不運行測試
- 11. 如何執行在JUnit測試測試多個文件
- 12. 我如何使用摩卡嵌套測試執行依賴測試
- 13. 軟件測試FAT執行
- 14. 我該如何平行運行測試套件XML文件?
- 15. 執行整個測試套件時,單元測試用例失敗
- 16. 如何通過命令行運行測試套件的一些測試用例?
- 17. 測試框架如何停止運行測試的執行?
- 18. 如何使用testng.xml從大型TestNG套件執行一個測試?
- 19. 如何在TestNG for之前執行代碼。建立測試套件
- 20. TestNG的測試套件的執行時間
- 21. 實習生4:無法執行測試套件
- 22. 自定義模塊中Junit測試套件的執行
- 23. 使用相同的webInstance執行測試套件
- 24. 如何使用request.post執行django測試?
- 25. 如何自動執行測試
- 26. 我如何執行ROR測試
- 27. 如何在R中執行wilcox測試?
- 28. 如何測試akka.net執行者演員
- 29. 如何得到執行JUnit測試
- 30. 如何在R中執行Hartley測試
你用soapUI中? – 2011-06-16 09:24:57
你試過我的下面的答案嗎?你能分享你的結果嗎?謝謝 – Suha 2012-11-07 13:42:03
@Suha這裏的OP在這裏還沒有一年多的時間。 – 2012-11-07 19:47:40