2017 bis heute 2016 2015 2014 | 2013 | 2012 | 2011 2010 2009 | 2008 | 2007

(ältere Archiveinträge vor 2007 nicht dargestellt, aber in der Suche enthalten)

Mailingliste - Einträge 2015

[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
# write everything to file
fileOut = FileOutputStream(excelFilePath)

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,

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


qftest-list mailing 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)

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