List Icon
Archiv Mailingliste

2019 bis Juli 2022  2018  | 2017 2016 2015 | 2014 | 2013

Die Mailingliste ist seit Juli 2022 geschlossen, dient aber weiterhin als Informationsarchiv zu QF-Test.
Wenn Sie aber über Neuerungen zu QF-Test informiert bleiben wollen, können Sie einfach unseren
Newsletter abonnieren

Um aktuell die Informationen zu jeder Release - auch Minor Releases - zu bekommen, können Sie den
RSS-Feed abonnieren oder uns in sozialen Medien folgen.
Alternativ bietet QF-Test auch selbst eine Versionsinformation an.

Eine weitere Informationsquelle ist unser Blog, in dem es aktuelle Beiträge zu allgemeinen Themen, zur Firma QFS und auch diverse "How-Tos" gibt:
Blog abonnieren


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [QF-Test] Writing QFT O/P to excel


  • Subject: Re: [QF-Test] Writing QFT O/P to excel
  • From: "Yann Spoeri, QFS Support (Extern)" <support@?.de>
  • Date: Thu, 14 May 2015 21:16:26 +0200

Hi Vinod and all other list participants,

QF-Test saves the commandline output of an application in the special variable ${qftest:client.output.<name of the client>} (cmp.
http://www.qfs.de/qftest/manual/en/user_variables.html#usec_externaldata). So in order to access the client output in a script, you can use a
line like:

clientOutput = rc.lookup("qftest", "client.output.<name of the client>")

The client output needs to get parsed and stored into an excel file then.

Writing to an excel file:

QF-Test comes along with two librarys to write to an excel file. The older one is jxl. An example for writing to an excel file using jxl can
already be found on the mailing list: http://www.qfs.de/archive/qftest-list/2010/msg00147.html
The other library is apache poi:

from org.apache.poi.hssf.usermodel import HSSFWorkbook
from org.apache.poi.xssf.usermodel import XSSFWorkbook
from org.apache.poi.ss.usermodel import Cell, Row
from java.io import FileInputStream, FileOutputStream, FileNotFoundException

# The excel file to create and write to
excelFilePath = "D:\\sup\\example.xlsx"
# The name of the sheet in the excel file to write to
sheet = "example"
# The row to write to (0-indexed).
rowToWriteTo = 10
# The col to write to (0-indexed).
colToWriteTo = 10
# The text to write to that cell
textToWrite = "Hello World"

# create a new excel workbook
wb = HSSFWorkbook()
# check if the sheet already exist; if not create it
ws = None
ws = wb.getSheet(sheet)
if ws == None:
    ws = wb.createSheet(sheet)
# get the cell in the sheet
row = ws.getRow(rowToWriteTo)
if row == None:
    row = ws.createRow(rowToWriteTo)
cell = row.getCell(colToWriteTo)
if cell == None:
    cell = row.createCell(colToWriteTo)
# write to that cell
cell.setCellValue(textToWrite)
# write everything to file
fileOut = FileOutputStream(excelFilePath)
try:
    wb.write(fileOut)
finally:
    fileOut.close()

Last but not least you can also write to a csv file which is often easier to program. Jython comes along with a great csv reading and writing
library; see: https://docs.python.org/2/library/csv.html . It's no problem to open csv files in excel.

Greetings & Happy testing,
    Yann

Am 12.05.2015 um 09:20 schrieb Hejib, Vinod IN BLR STS:
Hi all,

I have an application which generates test-case numbers as o/p when run using QFT.
I want to write these o/p test cases(numbers) to excel.Can you please tell how can I do the same.

###	I want to write below generated o/p to excel in each column.

No of usecases 	4
No of tests		2
No of procedures	8

Regards
Vinod








_______________________________________________
qftest-list mailing list
qftest-list@?.de
http://www.qfs.de/mailman/listinfo/qftest-list

--
_______________________________________________________________

Get the most out of QF-Test - Support directly from the authors
* Training & consulting: www.qfs.de/en/qftest/training.html
* Phone & email support: www.qfs.de/en/qftest/support.html
_______________________________________________________________

Yann Felix Spöri (Extern)
Support

E: support@?.de
T: +49 (0)8171 38648-20
F: +49 (0)8171 38648-16

Quality First Software GmbH | www.qfs.de
Tulpenstr. 41 | 82538 Geretsried | Germany
GF Gregor Schmid, Karlheinz Kellerer
HRB München 140833