Excel Step excelVerifyCellStyle
Description
This step verifies the style of a specified cell in an Excel spreadsheet. Only those properties set will be checked.
Parameters
- align
- Required? no
- The expected horizontal alignment. One of center, center-selection, fill, general, justify, left, right
- border
- Required? no
- The expected border style. One of dash dot, dash dot dot, dashed, dotted, double, hair, medium, medium dash dot, medium dash dot dot, medium dashed, slanted dash dot, thick, thin, none. See below for details on specifying sides.
- borderColor
- Required? no
- The expected border color. Specify as #rrggbb or use a standard name. See below for details on specifying sides.
- cell
- Required? yes/no
- The spreadsheet cell to select. eg. A5. Either cell or row and col must be specified.
- col
- Required? no
- The name or number (starting at 1) of the column to select. eg 1 or A. Either cell or row and col must be specified.
- description
- Required? no
- The description of this test step.
- fillBackgroundColor
- Required? no
- The expected background cell fill color. Specify as #rrggbb or use a standard name.
- fillColor
- Required? no
- The expected foreground cell fill color. Specify as #rrggbb or use a standard name.
- fillPattern
- Required? no
- The expected fill pattern. One of none, solid, 50% gray, 75% gray, 25% gray, horizontal stripe, vertical stripe, reverse diagonal stripe, diagonal stripe, diagonal crosshatch, thick diagonal crosshatch, thin horizontal stripe, thin vertical stripe, thin reverse diagonal stripe, thin diagonal stripe, thin horizontal crosshatch, thin diagonal crosshatch, 12.5% gray, 6.25% gray
- fontName
- Required? no
- The expected font name. eg. Arial or Times
- fontSize
- Required? no
- The expected font size in points. eg 10 or 12
- fontStyle
- Required? no
- The expected font style. A combination of bold, italic, strikethrough, subscript, superscript, underline, underline-accounting, underline-double, underline-double-accounting separated by spaces, or normal
- format
- Required? no
- The format to check for. eg 0.00 for two decimal places.
- locked
- Required? no
- The expected locked status. true or false
- row
- Required? yes/no
- The number of the row to select, starting at 1. Either cell or row and col must be specified.
- sheetIndex
- Required? no
- The index of the sheet to select, starting at zero. If no sheet is selected, the value of the last excelSelectSheet call is used, or defaults to the first sheet.
- sheetName
- Required? no
- The name of the sheet to select. If no sheet is selected, the value of the last excelSelectSheet call is used, or defaults to the first sheet.
- textColor
- Required? no
- The expected text color. Specify as #rrggbb or use a standard name.
- type
- Required? no
- The expected cell type. One of blank, numeric, formula, string, boolean or error.
- valign
- Required? no
- The expected vertical alignment. One of bottom, center, justify, top
- wrap
- Required? no
- The expected wrap setting. true or false
Details
Here is an example using the excelVerifyCellStyle step:
<config .../>
<steps>
<invoke url="testExcel.xls"/>
<excelVerifyCellStyle cell="B37" border="top:thick; bottom:dash dot; left:none; right:medium dash dot"
borderColor="top:auto; bottom:plum; left:none; right:bright green"
fillColor="tan" fillBackgroundColor="red" textColor="green"
fontName="Arial" fontSize="12" fontStyle="strikethrough bold italic underline"
align="center" valign="top" fillPattern="thin diagonal stripe"
description="A bit of everything"/>
<excelVerifyCellStyle cell="A6" border="left:thin"/>
</steps>
</webtest>
For the border and borderColor properties, you can have fine grained control over what is expected for the border on each side of the cell. Here are some examples:
This tests for a thin border all the way around the cell.
This tests for a red border on the left of the cell. The other borders are ignored.
This tests for no borders on the top and left of the cell, a thin border on bottom and a dashed one to the right
This tests for a blue border on the left, right and top sides and no border on the top.
For the borderColor, textColor, fillColor and fillBackgroundColor properties, you can use the following standard color names instead of hex values: aqua, black, blue, blue gray, bright green, brown, coral, dark blue, dark green, dark purple, dark red, dark teal, dark yellow, gold, green, 25% gray, 40% gray, 50% gray, 80% gray, ice blue, indigo, ivory, lavender, light blue, light green, light orange, light turquoise, light yellow, lime, maroon, ocean blue, olive green, orange, pale blue, periwinkle, pink, plum, red, rose, sea green, sky blue, tan, teal, turquoise, violet, white, yellow.