What This Manual Covers
This manual describes how to create MaxTAF tests.
Before you start reading this guide, you should be familiar with MaxTAF basics as laid out in the "MaxTAF User's Guide".
Types Of MaxTAF Tests
There are generally, three types of MaxTAF tests:
- JUnit Tests
- MXML Tests
- UI Tests
JUnit tests are the fundamental types of tests for MaxTAF framework. JUnit is a framework for creating unit tests for Java based applications. JUnit tests are themself written in the Java language, hence Java skills are a prerequisite for creating such MaxTAF tests.
MXML tests use MaxTAF proprietary XML language for writing/configuring tests. MXML is a library of XML elements/tags that specialize in specific testing activities. Additionally, MXML provides elements that allow flow control (if-then-else), tags that work with variables, and other similar functionality that is required for advance scripting/programming.
UI tests utilize the open source Selenium framework, that enables browser automation tasks. Typically, the UI test will first be recorded (e.g. you will record a Maximo session) using a Firefox add-on called Selenium IDE. The recording will then be converted to MaxTAF (either to MXML or to JUnit). Thereafter you can run the recording like any other MaxTAF tests with a difference that, instead of working in the background like ordinary JUnit or MXML test, a browser will be launched and the recorded session will be repeated without human involvement.
JUnit Tests
JUnit Overview
JUnit is a testing framework for Java programming language. There is an abundance of resources, documentation and training material for JUnit, both online and off-line, starting with the JUnit official web site at http://www.junit,org. This guide will only present a very brief overview and the developer is encouraged to explore JUnit further.
MaxTAF for Maximo version 7.x and higher implements JUnit 4, which in turn uses annotation style programming.
In its simplest form, a JUnit 4 test requires import of the JUnit package and a method annotated as @Test:
package rs.cdl.maxtaf.miftest; import static org.junit.Assert.assertFalse; import java.rmi.RemoteException; import org.junit.Test; import psdi.server.*; import psdi.util.MXException; public class TestAdminMode { @Test public void testAdminModeSwitchedOff() throws RemoteException, MXException { assertFalse("Result", MXServer.getMXServer().isAdminModeOn(true)); } }
The table below shows JUnit annotation:
Table 1. Annotations
Annotation | Description |
@Test public void method() | The annotation @Test identifies that a method is a test method. |
@Before public void method() | Will execute the method before each test. This method can prepare the test environment (e.g. read input data, initialize the class). |
@After public void method() | Will execute the method after each test. This method can cleanup the test environment (e.g. delete temporary data, restore defaults). |
@BeforeClass public void method() | Will execute the method once, before the start of all tests. This can be used to perform time intensive activities, for example to connect to a database. |
@AfterClass public void method() | Will execute the method once, after all tests have finished. This can be used to perform clean-up activities, for example to disconnect from a database. |
@Ignore | Will ignore the test method. This is useful when the underlying code has been changed and the test case has not yet been adapted. Or if the execution time of this test is too long to be included. |
@Test (expected = Exception.class) | Fails, if the method does not throw the named exception. |
@Test(timeout=100) | Fails, if the method takes longer than 100 milliseconds. |
The following table shows various test methods you can use in JUnit:
Table 2. Test methods
Statement | Description |
fail(String) | Let the method fail. Might be used to check that a certain part of the code is not reached. Or to have failing test before the test code is implemented. |
assertTrue(true) / assertTrue(false) | Will always be true / false. Can be used to predefine a test result, if the test is not yet implemented. |
assertTrue([message], boolean condition) | Checks that the boolean condition is true. |
assertsEquals([String message], expected, actual) | Tests that two values are the same. Note: for arrays the reference is checked not the content of the arrays. |
assertsEquals([String message], expected, actual, tolerance) | Test that float or double values match. The tolerance is the number of decimals which must be the same. |
assertNull([message], object) | Checks that the object is null. |
assertNotNull([message], object) | Checks that the object is not null. |
assertSame([String], expected, actual) | Checks that both variables refer to the same object. |
assertNotSame([String], expected, actual) | Checks that both variables refer to different objects. |
MXML Tests
MXML tests use MaxTAF proprietary XML language for writing/configuring tests. MXML is a library of XML elements/tags that specialize in specific testing activities. Additionally, MXML provides elements that allow flow control (if-then-else), tags that work with variables, tags for reporting and other similar functionality that is required for advance scripting/programming.
Understanding Test Structure
<?xml version="1.0" encoding="ISO-8859-1"?> <testCase name="AdminModeXML" xmlns="http://www.maxtaf.com"> <beforeTestCase> <addReporter type="xml" name="AdminModeXML" description="Testing for Admin Mode" class="" author="author" /> </beforeTestCase> <test name="NewMIFTest"> <addTestReport name="Test1" /> <isAdminModeOff /> <addReportLine action="Checking Admin Mode" expected="Admin Mode Off" actual="Admin Mode Off" status="PASSED" /> <testReportStatus>PASSED</testReportStatus> </test> <afterTestCase> <closeReporter /> </afterTestCase> </testCase>
Example MXML test script
Like all well formed XML documents, MXML should start with the
xml
tag:
<?xml version="1.0" encoding="ISO-8859-1"?> ...
This is immediately followed by the root element which is
testCase
where you name the test case and specify name spaces:
<?xml version="1.0" encoding="ISO-8859-1"?> <testCase name="AdminModeXML" xmlns="http://www.maxtaf.com"> <beforeTestCase> <addReporter ...
The first element within the testCase
is called
beforeTestCase
and is used to initialize test case-wide parameters,
like the reporter:
... <testCase name="AdminModeXML" xmlns="http://www.maxtaf.com"> <beforeTestCase> <addReporter type="xml" name="AdminModeXML" description="Testing for Admin Mode" class="" author="author" /> </beforeTestCase> ...
Then you have the main element called test
and that is where
all the logic of the test is contained. Depending on your
license, you can have one or many test
tags in your test script.
... </beforeTestCase> <test name="NewMIFTest"> <addTestReport name="Test1" /> <isAdminModeOff /> <addReportLine action="Checking Admin Mode" expected="Admin Mode Off" actual="Admin Mode Off" status="PASSED" /> <testReportStatus>PASSED</testReportStatus> </test> <afterTestCase> ...
The last tag is always afterTestCase
, used for the clean-up:
... </test> <afterTestCase> <closeReporter /> </afterTestCase> </testCase>
Key Elements
testCase
testCase
is the root element for MXML tests, meaning that every
MXML test must start with this element. testCase
element has the
following attributes:
name |
This attribute must be the same as the name of the Test File that you have specified for this test. |
xmlns |
Namespace attribute. Must have at least
xmlns="http://www.maxtaf.com". If you are planning to use extended functionality in specialized name spaces, then each of these name spaces needs to be listed here e.g xmlns:ui="http://www.maxtaf.com/ui". |
Example:
<?xml version="1.0" encoding="ISO-8859-1"?> <testCase name="ImportWO_HTTP_EJB" xmlns="http://www.maxtaf.com" xmlns:ui="http://www.maxtaf.com/ui" xmlns:mif="http://www.maxtaf.com/mif" xmlns:mbo="http://www.maxtaf.com/mbo"> ... </testCase>
beforeTestCase
After you have specified the root element, your next element will
be beforeTestCase
. The purpose of this element is to perform the
initial setting of the test run. Typically, this is the place where you
will initialize your test report using the element addReporter
.
Example:
<beforeTestCase> ... </beforeTestCase>
addReporter
To use the built-in reporting facilities in your MXML test, you
must specify the addReporter
tag within the beforeTestCase
tag. The
addReporter
element has the following attributes:
type |
Type of report: simple or xml.
simple type produces a non-formated text output, like a text
file. xml type produces a web-page style report. See <<report>> section for further details. |
name |
The name that appears in the heading of the report |
description |
Description that appears in the heading of the report |
class |
Name of the test class or file in the heading |
author |
Name of the author |
Example:
<addReporter type="xml" name="TestNewFlatStructure" description="Testing new flat structure" class="rs.cdl.xmltests.FlatStructureTesting.java" author="DD"/>
This will produce the following output:
test
This element contains the actual test script. All of the test
scenario actions are defined within this element. The test
element
has the following attributes:
name |
Unique name for the test - required |
id |
Optional test id |
addTestReport
This is a mandatory element that instantiates individual test
report. This element must be located at the top of the test
element.
The test
element has the following attributes:
name |
Test report name |
Example:
<test name="NewMIFTest"> <addTestReport name="Test1" />
addReportLine
This element adds a line to the test report.
The addReportLine
element has the following attributes:
action |
Text for the action segment |
expected |
Text for the expected segment |
actual |
Text for the actual segment |
status |
Text for the status segment |
Example:
<addReportLine action="Getting work order from database" expected="Finding work order with description: Testing import of WO 1" actual="Work order not found" status="FAILED"/>
afterTestCase
This needs to be the last element within your testCase
tag. Use
this element to perform clean up operations like closing the report.
Complete Element Library
MXML element library consists of tags which are grouped into several categories:
General MXML tags - these tags deal with the general test behavior and logic. They are used to control the general flow of the test, for example what happens before and after the start of the test, what happens after the test has completed.
MBO tags - these tags are used for direct MBO interaction. They can be used to invoke or query MBO logic.
MIF tags - these tags are used for the Maximo integration framework interaction. They can be used to invoke MIF related logic, for example to check the external system, enterprise services, publish channels, object structures, cron tasks etc.
UI tags - these tags are used to interact with elements which can be seen on the screen and are needed to run Selenium based tests. They can be used to check HTML elements, text, perform clicks on the page, populate and clear text input elements, open Maximo applications, take screenshots etc.
DB tags - these tags are used to perform database related transactions. They can be used to open and close connection to the DB, to fetch results, loop through results etc.
NET tags - these tags are used to perform basic network related operations. They can be used to ping hosts with IP addresses, get response code from specific URL etc.
TIME tags - these tags deal with time related functionality. They can be used to measure time intervals, get current date, month, hours, minutes etc.
WF tags - these tags are used for Maximo workflow management. They can be used to initiate, complete or stop workflows, check for user's assignments etc.
General Tags
addReporter |
Sets-up the test Reporter. The test Reporter is a mechanism in Maxtaf that produces the output run report. It must be located within the Example: <addReporter type="xml" name="Create Company Master" description="Testing Company Master application functionality" class="rs.cdl.maxtaf.test.CompanyMasterTestUI" author="John" />Attributes
|
|||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
addReportLine |
Adds a report line to the test report. Example: <addReportLine action="$titleText" expected="Company Master application is opened" actual="Company Master application is opened" status="PASSED" />Attributes
|
|||||||||||||||||||||
addTestReport |
Adds a new test report to the reporter. Located within the Since a MaxTAF test case can contain more than one MXML test tags, we can add several reports. Example: <addTestReport name="createCompanyMaster" />Attributes
|
|||||||||||||||||||||
afterTest |
Contains any processing that is required to be executed after
a There can only be one afterTest tag in a MaxTAF test case, and the pocessing within the tag will be executed/repeated after the completion of any of the test tags in the test case. Example: <afterTest> <mif:removeListener/> </afterTest> |
|||||||||||||||||||||
afterTestCase | Contains any processing that is required to be executed after the test case is completed. | |||||||||||||||||||||
apiInput |
Used for exchanging values between test cases in a suite. Takes on the value of the Example: ... <apiOutput var="newWoNum"/> ... ... <var type="String" name="woNum">null</var> <apiInput var="woNum"/> ....Attributes
|
|||||||||||||||||||||
apiOutput |
Used for exchanging values between test cases in a suite. Takes the value of the variable specified in the Example: ... <apiOutput var="newWoNum"/> ... ... <var type="String" name="woNum">null</var> <apiInput var="woNum"/> ....Attributes
|
|||||||||||||||||||||
assertFail |
Unconditionaly fails the test. If the optional subelement Example: ... <if condition="mboRemoteWO=null"> <assertFail> <assertMessage> Work Order not found</assertMessage> </assertFail> </if> |
|||||||||||||||||||||
assertFalse |
Asserts whether the condition is If the condition is Example: <assertFalse condition="1==2"/>Attributes
|
|||||||||||||||||||||
assertNotNull |
Checks that the object is not Object can be of any Java type. Example: <var name="myString" type="String">"Test"</var> <assertNotNull object="myString"> <assertMessage>Object is null. Test failed.</assertMessage> </assertNotNull>Attributes
|
|||||||||||||||||||||
assertNotSame |
Checks that both variables refer to different objects. Must contain both unexpected and actual attributes, then compares the two. If they are referencing different objects, returns Example: <var name="myString1" type="String">new String("abc")</var> <var name="myString2" type="String">new String("abc")</var> <assertNotSame unexpected="myString1" actual="myString2"> <assertMessage>Unexpected is same as actual. Test failed.</assertMessage> </assertNotSame>Attributes
|
|||||||||||||||||||||
assertNull |
Checks that the object is Object can be of any Java type. Example: <var name="myString" type="String">"Test"</var> <assertNull object="myString"> <assertMessage>Object is not null. Test failed.</assertMessage> </assertNull>Attributes
|
|||||||||||||||||||||
assertSame |
Checks that both variables refer to the same object. Variables can be of any Java type. Example: <var name="myInt1" type="Integer">new Integer(1)</var> <var name="myInt2" type="Integer">myInt1</var> <var name="myInt3" type="Integer">myInt1</var> <assertSame expected="myInt2" actual="myInt3"> <assertMessage>Expected object is not the same as actual object. Test failed.</assertMessage> </assertSame>Attributes
|
|||||||||||||||||||||
assertTrue |
Asserts whether the condition is Displays Example: <var name="a" type="String">"Test String 1"</var> <var name="b" type="String">"Test String 1"</var> <assertTrue condition="a.equals(b)"> <assertMessage>Condition is not true. Test failed.</assertMessage> </assertTrue>Attributes
|
|||||||||||||||||||||
beforeTest |
Executes the content of this element before each test. This element can be used to prepare the environment for the execution of the test. Note: the processing will be repeated before every test in the test case. |
|||||||||||||||||||||
beforeTestCase |
Executes the content of this element before the test case. Content of this element can be used to prepare the test case environment (e.g. add a reporter). Example: <beforeTestCase> <ui:createDriver> <ui:timeout>60</ui:timeout> </ui:createDriver> <ui:javaScriptExecutor /> <addReporter type="xml" name="Create Company Master" description="Testing Company Master application functionality" class="rs.cdl.maxtaf.test.CompanyMasterTestUI" author="Pera" /> </beforeTestCase> |
|||||||||||||||||||||
block |
Localizes variables defined within this element. The variables defined within this element will be visible to other elements in the block, but will not be visible to the rest of the test elements. Example: <block> <var name="a" type="int">0</var> <addReportLine action="value of a is $a" expected="" actual="" status="PASSED" /> </block> <block> <var name="a" type="int">1</var> <addReportLine action="value of a is $a" expected="" actual="" status="PASSED" /> </block> |
|||||||||||||||||||||
dowhile |
Executes code conditionally until the condition is no longer met. Example: <var name="a" type="int">1</var> <dowhile condition="a < 10"> <set variable="a">a+1</set> </dowhile>Attributes
|
|||||||||||||||||||||
else |
Used only with existing Executes code in case the Note: This element must be positioned immediately after the
Example: <var name="b" type="int">2</var> <if condition="b==1"> <addReportLine action="ifTest" expected="if Triggered" actual="if Triggered" status="PASSED" /> </if> <else> <addReportLine action="elseTest" expected="else Triggered" actual="else Triggered" status="PASSED" /> </else> |
|||||||||||||||||||||
endTest |
Unconditionally ends the test. Example: <addTestReport name="endTestReport" /> <var name="a" type="int">1</var> <if condition="a==1"> <endTest /> </if> <addReportLine action="ifPassed" expected="this line will never execute as the test has been previously ended" actual="" status="PASSED" /> |
|||||||||||||||||||||
execute |
Executes specified object’s method using the given parameters. The executed method must not return a value. As all MXML objects are Java objects, this element can invoke any of the Java methods available for the object's class. To understand object's methods, consult the Java documentation for the object's class. Note: For methods that return a value, use Child element(s):
Method parameters should be written in element content, separated by commas in the same way as they would be written in Java, as in the example below: Example: <!-- equivalent to Java "String myString = "Test String"; myString.indexOf("ring", 1); <var name="myString" type="String">"Test String"</var> <execute object="myString" method="indexOf"> <params>"ring", 1</params> </execute>Attributes
|
|||||||||||||||||||||
executeWithReturn |
Executes specified object’s method using the given parameters and stores the return value in the specified variable. The executed method must return a value. As all MXML objects are Java objects, this element can invoke any of the Java methods available for the object's class. To understand object's methods, consult the Java documentation for the object's class. Note: For methods which do not return a value, use Child elements:
Method parameters should be written in element's content like in the example below: Example: <var name="myString" type="String">"Test String"</var> <var name="ringPos" type="int">0</var> <executeWithReturn object="myString" method="indexOf" var="ringPos"> <params>"ring", 1</params> </executeWithReturn> <addReportLine action="Result: $ringPos" expected="" actual="" status="PASSED" />Attributes
|
|||||||||||||||||||||
fileToString |
Reads a file content into a string. File content from a file referenced by Example: <var name="importFileString" type="String">""</var> <fileToString filePath="$assettemplate" var="importFileString"/>Attributes
|
|||||||||||||||||||||
for |
Repeats the processing of its content until the condition is false. This loop element is based on Java Example: <for iterator="int i=0" condition="i<10" iteration="i++"> <printOut>i</printOut> <addReportLine action="Increasing iterator value, value is $String.valueOf(i)" expected="iterator value:" actual="value is $String.valueOf(i) " status="PASSED" /> </for>Attributes
|
|||||||||||||||||||||
getMaxtafProperty |
Attributes
|
|||||||||||||||||||||
getTestParam |
Gets a specific run parameter value of the Test and places it into the specified variable. Parameters are defined in the Maximo front-end Test application. Example: Parameters defined in the Test application: woNum='1000' siteId = 'BEDFORD' Code: <var name="wonum" type="String">""</var> <var name="siteid" type="String">""</var> <getTestParam name="woNum" variable="wonum" /> <getTestParam name="siteId" variable="siteid" /> <addReportLine action="wonum: $wonum" expected="" actual="" status="PASSED" /> <addReportLine action="siteid: $siteid" expected="" actual="" status="PASSED" />Attributes
|
|||||||||||||||||||||
globals |
Used do define global variables. Global variables are visible in all tests in test case. Example: <testCase> <globals> <var type="String" name="var1">"Variable 1"</var> <var type="int" name="var2">1001</var> </globals> ... |
|||||||||||||||||||||
if |
Executes content if the condition is Example: <var name="myInt" type="int">1</var> <if condition="myInt==1"> <addReportLine action="ifTest" expected="if Triggered" actual="if Triggered" status="PASSED" /> </if>Attributes
|
|||||||||||||||||||||
imports |
Imports additional Java classes and packages. The Java classes and packages are specified in children
Example: <imports> <import> java.lang.Exception </import> <import> rs.cdl.util.* </import> </imports> |
|||||||||||||||||||||
include |
Use this tag when you want to insert a segment of MXML script into your test case. Typically, when the same MXML set of tags is repeated between many different test cases, you can save that segment in a file and then put the "include" tag in your scripts insted of repeating the same code over and over. This approach lets you maintain this common code in one file only. <test name='testWOreportActuals'> <addTestReport name="testDuke"/> <ui:maximizeWindow /> <!-- include the xml that has all the clicks and types to create and approve a standard corrective work order --> <include path="C:\\ibm\\SMP\\maximo\\maxtaf\\script\\create_approve_wo.xml" /> <!-- work order is now cretaed and approved and we are on the Main tab. Now switch to the 'Actuals' tab and report actuals --> <!-- [ click ] tab - Actuals --> <ui:click> <ui:xpath>//a[@staticId='actuals-tab_tab_anchor']</ui:xpath> </ui:click> <ui:click> <ui:xpath>//div[@staticId='clientarea-clientarea_clientarea']</ui:xpath> </ui:click> <!-- [ click ] pushbutton --> <ui:click> <ui:xpath>//button[@staticId='actuals_actuals_aclabor_aclabor_table_2_3-pushbutton_pushbutton']</ui:xpath> </ui:click> </testCase>The content of the include <segment xmlns:ui="http://www.maxtaf.com/ui"> <ui:click> <ui:xpath>//img[@staticId='toolactions_button_0-toolbarbutton_image_image']</ui:xpath> </ui:click> <ui:click> <ui:xpath>//img[@staticId='toolactions_button_1-toolbarbutton_image_image']</ui:xpath> </ui:click> <ui:click> <ui:xpath>//img[@staticId='toolactions_button_14-toolbarbutton_image_image']</ui:xpath> </ui:click> <ui:click> <ui:xpath>//button[@staticId='changestatus_2_1-pushbutton_pushbutton']</ui:xpath> </ui:click> <ui:click> <ui:xpath>//span[@staticId='gotolink-gotolink_link1']/span/span[3]</ui:xpath> </ui:click> <ui:click> <ui:xpath>//span[@staticId='gotolink-gotolink_link1']/span/span[3]</ui:xpath> </ui:click> </segment>Note that the included xml file WILL NOT pass through the XSD validation. The invalid xml content will be ignored by the compiler. It is up to the developer of that xml file to make sure that the content is valid. |
|||||||||||||||||||||
incrementProperty |
Increments the value of MaxTAF property var .
Attributes
|
|||||||||||||||||||||
inverse |
Inverses the outcome of the contained element. Used to inverse the logic of a specified element. I.e. where the specified element fails, the inverse passes; where the specified element passes the inverse fails. Example: <!-- pass if www.maxtaf.com is unreachable (testing the firewall) --> <inverse> <net:ping host="http://www.maxtaf.com"/> </inverse> |
|||||||||||||||||||||
isAdminModeOff |
Checks if Maximo Admin mode is OFF. Example: <isAdminModeOff /> |
|||||||||||||||||||||
isAdminModeOn |
Checks if Maximo Admin mode is ON. Example: <isAdminModeOn /> |
|||||||||||||||||||||
Prints out element's content to the SystemOut or SystemErr log. Used in
Example: <printOut>"Company master name is "+compMasterName</printOut> <printErr>"There is no work order with num: "+wonum</printErr> |
||||||||||||||||||||||
reportGroup |
Overrides MaxTAF generated test reports with custom action, expected, actual and status messages. Actual message will be overridden by Status message will be overridden by Example: <reportGroup action="Check publish channel" expected="disabled" passActual="disabled. " failActual="enabled" passStatus="GOOD" failStatus="BAD"> <mif:publishChannelExistOnExternalSystem name="MXWOInterface" externalSystemName="EXTSYS1"/> <mif:publishChannelEnabled name="MXWOInterface" externalSystemName="EXTSYS1"/> <mif:publishChannelEventListenerEnabled name="MXWOInterface"/> </reportGroup>Attributes
|
|||||||||||||||||||||
set |
Assigns a value to a variable. The content of this element is an expression. The resulting value of this expression is assigned to the
variable named in the Note: the resulting type of the expression must be compatible with the type of the variable, otherwise you will get a type mismatch. Example: <test name="setFixedString"> <var name="myString" type="String">""</var> <set variable="myString">"ABC"</set> <assertTrue condition='myString.equals("ABC")'/> </test> <test name="setExpressionString"> <var name="myString" type="String">""</var> <var name="yourString" type="String">"ABC"</var> <set variable="myString">yourString + "XYZ"</set> <assertTrue condition='myString.equals("ABCXYZ")'/> </test> <test name="setExpressionInt"> <var name="myInt" type="int">0</var> <var name="yourInt" type="int">10</var> <var name="herInt" type="int">4</var> <set variable="myInt">yourInt + 20 / herInt</set> <assertTrue condition='myInt==15'/> </test> |
|||||||||||||||||||||
setTestParam |
Sets a specific run parameter value of the Test. Parameters are defined in the Maximo front-end Test application. Example: Parameters defined in the Test application: woNum='1000' siteId = 'BEDFORD' Code: <setTestProperty name="woNum" value="1000" /> <setTestProperty name="siteId" value="EAGLENA" /> <addReportLine action="wonum: $wonum" expected="" actual="" status="PASSED" /> <addReportLine action="siteid: $siteid" expected="" actual="" status="PASSED" />Attributes
|
|||||||||||||||||||||
stringReplace |
Replaces portions of a string with defined Example: <var name="importFileString" type="String">""</var> <fileToString filePath="$assettemplate" var="importFileString"/> <stringReplace replace="~assetnum~" with="$assetnum" var="importFileString"/>Attributes
|
|||||||||||||||||||||
stringToFile |
Writes a string to a file. Writes a text to a file with file path Example: <var name="importFileString" type="String">""</var> <fileToString filePath="$assettemplate" var="importFileString"/> <stringReplace replace="~assetnum~" with="$assetnum" var="importFileString"/> <stringReplace replace="~location~" with="$location" var="importFileString"/> <stringToFile filePath="c:/demo/assetimport/assetimport.xml" content="importFileString"/>Attributes
|
|||||||||||||||||||||
test |
Contains the actual test processing. This is the main test element in which you perform all of the test processing. Example: <test name="ifTest"> </test>Attributes
|
|||||||||||||||||||||
testCase |
Root element of MXML. Test case is the collection of all related tests into one logical group. Example: <testCase name="WOAPPRTest" xmlns="http://www.maxtaf.com" xmlns:mif="http://www.maxtaf.com/mif">Attributes
|
|||||||||||||||||||||
testReportStatus |
Sets report status. Report status will be set to the element value. Example: <testReportStatus>PASSED</testReportStatus> |
|||||||||||||||||||||
var |
Defines a new test variable. The value of the variable is set to the element's value. The type of the variable is one of the valid Java types. Example: <var type="String" name="orgId">"EAGLENA"</var> |
|||||||||||||||||||||
while |
Repeats the processing of its content until the condition
becomes Example: <while condition="counter<5"> <printOut>counter</printOut> <addReportLine action="Increasing counter value" expected="counter value:" actual="$String.valueOf(counter) " status="PASSED" /> <set variable="counter">counter+1</set> </while>Attributes
|
MBO Tags
mbo:duplicate |
Duplicates MBO. Does the same thing as Duplicate action from Select Action menu in Maximo applications. Example: <test name="testSimpleDuplicate"> <var type="MboRemote" name="mboOriginal">null</var> <var type="MboRemote" name="mboDuplicated">null</var> <mbo:get objectName="WORKORDER" var="mboOriginal"> <mbo:where> WONUM = '1000' </mbo:where> </mbo:get> <mbo:duplicate var="mboDuplicated" original="mboOriginal" /> <assertNotNull object="mboDuplicated"> <assertMessage> Work order not duplicated. Test failed.</assertMessage> </assertNotNull> </test>Attributes
|
|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mbo:forEach |
Iterates over MBO set held in variable Creates two local variables -
Example: <test name="testForEachSimple"> <var type="MboSetRemote" name="woSet">null</var> <mbo:getSet objectName="WORKORDER" var="woSet"> <mbo:where> PARENT = '1000' </mbo:where> </mbo:getSet> <mbo:forEach mboSet="woSet"> <mbo:getStringAttributeValue name="WONUM" mbo="currentMbo" var="woNum" /> </mbo:forEach> </test>Attributes
|
|||||||||||||||
mbo:get |
Retrieves
If If Example: <test name="testMboGetSimple"> <var type="MboRemote" name="wo">null</var> <var type="MboRemote" name="woActivity">null</var> <!-- Get work order with wonum = '1000' --> <mbo:get objectName="WORKORDER" var="wo"> <mbo:where> wonum = '1000' </mbo:where> </mbo:get> <!-- Get task which has wonum = '1000-20' and which is a child of work order referenced by 'wo' variable and 'parent=:wonum and siteid=:siteid' relationship --> <mbo:get objectName="WOACTIVITY" var="woActivity"> <mbo:parent var="wo"> <mbo:relationship> parent=:wonum and siteid=:siteid </mbo:relationship> </mbo:parent> <mbo:where> wonum = '1000-20' </mbo:where> </mbo:get> </test>Attributes
|
|||||||||||||||
mbo:getBooleanAttributeValue |
Retrieves the boolean value of the attribute identified by
In order to handle the condition where the passed attrubute
this command first gets the correct object and then retrieves the boolean value of the attribute from it. In the ASSET.CHILDREN case, the appropriate object to retrieve the boolean value of CHILDREN from should not be WorkOrder. Rather, it should be an asset object obtained from the
relationship ASSET where If the attibute Example: <test name="testGetBooleanSimple"> <var type="MboRemote" name="wo">null</var> <var type="boolean" name="isTask">true</var> <mbo:get objectName="WORKORDER" var="wo"> <mbo:where> WONUM = '1000' </mbo:where> </mbo:get> <mbo:getBooleanAttributeValue name="ISTASK" mbo="wo" var="isTask" /> </test>Attributes
|
|||||||||||||||
mbo:getDateAttributeValue |
Retrieves the date value of the attribute identified by In order to handle the condition where the passed attribute
this command first gets the correct object and then retrieves the date value of the attribute from it. In the ASSET.STATUSDATE case, the appropriate object to retrieve the date value of STATUSDATE from should not be WorkOrder. Rather, it should be an asset object obtained from the
relationship ASSET where If the attribute Example: <test name="testGetDateSimple"> <var type="MboRemote" name="wo">null</var> <var type="java.util.Date" name="statusDate">null</var> <mbo:get objectName="WORKORDER" var="wo"> <mbo:where> WONUM = '1000' </mbo:where> </mbo:get> <mbo:getDateAttributeValue name="STATUSDATE" mbo="wo" var="statusDate" /> </test>Attributes
|
|||||||||||||||
mbo:getDoubleAttributeValue |
Retrieves the double value of the attribute identified by
In order to handle the condition where the passed attribute
this method first gets the correct object and then retrieves the double value of the attribute from it. In the ASSET.TOTALCOST case, the appropriate object to retrieve the double value of TOTALCOST from should not be WorkOrder. Rather, it should be an ASSET object obtained from the
relationship ASSET where If the attrubute Example: <test name="testGetDoubleSimple"> <var type="MboRemote" name="wo">null</var> <var type="double" name="assetPriority">0</var> <mbo:get objectName="WORKORDER" var="wo"> <mbo:where> WONUM = '1000' </mbo:where> </mbo:get> <mbo:getDoubleAttributeValue name="ASSETLOCPRIORITY" mbo="wo" var="assetPriority" /> </test>Attributes
|
|||||||||||||||
mbo:getFloatAttributeValue |
Retrieves the float value of the attribute identified by
In order to handle the condition where the passed attribute
this method first gets the correct object and then retrieves the float value of the attribute from it. In the ASSET.TOTALCOST case, the appropriate object to retrieve the float value of TOTALCOST from should not be WorkOrder. Rather, it should be an ASSET object obtained from the
relationship ASSET where If the attribute Example: <test name="testGetFloatSimple"> <var type="MboRemote" name="wo">null</var> <var type="float" name="assetPriority">0</var> <mbo:get objectName="WORKORDER" var="wo"> <mbo:where> WONUM = '1000' </mbo:where> </mbo:get> <mbo:getFloatAttributeValue name="ASSETLOCPRIORITY" mbo="wo" var="assetPriority" /> </test>Attributes
|
|||||||||||||||
mbo:getIntegerAttributeValue |
Retrieves the integer value of the attribute identified by
In order to handle the condition where the passed attribute
this method first gets the correct object and then retrieves the integer value of the attribute from it. In the ASSET.TOTALCOST case, the appropriate object to retrieve the integer value of TOTALCOST from should not be WorkOrder. Rather, it should be an ASSET object obtained from the
relationship ASSET where If the attribute Example: <test name="testGetIntegerSimple"> <var type="MboRemote" name="wo">null</var> <var type="int" name="assetPriority">0</var> <mbo:get objectName="WORKORDER" var="wo"> <mbo:where> WONUM = '1000' </mbo:where> </mbo:get> <mbo:getIntegerAttributeValue name="ASSETLOCPRIORITY" mbo="wo" var="assetPriority" /> </test>Attributes
|
|||||||||||||||
mbo:getLongAttributeValue |
Retrieves the long value of the attribute identified by In order to handle the condition where the passed attribute
this method first gets the correct object and then retrieves the long value of the attribute from it. In the ASSET.TOTALCOST case, the appropriate object to retrieve the long value of TOTALCOST from should not be WorkOrder. Rather, it should be an ASSET object obtained from the
relationship ASSET where If the attrubute Example: <test name="testGetLongSimple"> <var type="MboRemote" name="wo">null</var> <var type="long" name="assetPriority">0</var> <mbo:get objectName="WORKORDER" var="wo"> <mbo:where> WONUM = '1000' </mbo:where> </mbo:get> <mbo:getLongAttributeValue name="ASSETLOCPRIORITY" mbo="wo" var="assetPriority" /> </test>Attributes
|
|||||||||||||||
mbo:getSet |
Retrieves
If If Example: <test name="testMboGetSet"> <var type="MboSetRemote" name="woSet">null</var> <mbo:getSet objectName="WORKORDER" var="woSet"> <mbo:where> PARENT = '1000' </mbo:where> </mbo:getSet> </test>Attributes
|
|||||||||||||||
mbo:getStringAttributeValue |
Retrieves the string value of the attribute identified by
In order to handle the condition where the passed attribute
this method first gets the correct object and then retrieves the string value of the attribute from it. In the ASSET.TOTALCOST case, the appropriate object to retrieve the string value of TOTALCOST from should not be WorkOrder. Rather, it should be an ASSET object obtained from the
relationship ASSET where If the attribute Example: <test name="testGetStringSimple"> <var type="MboRemote" name="wo">null</var> <var type="String" name="description"> "Testing mbo:getStringAttributeValue" </var> <mbo:get objectName="WORKORDER" var="wo"> <mbo:where> WONUM = '1000' </mbo:where> </mbo:get> <mbo:getStringAttributeValue name="DESCRIPTION" mbo="wo" var="description" /> </test>Attributes
|
|||||||||||||||
mbo:getUniqueValue |
Generates the unique String value with prefix Note that this command isn't thread safe. If thread safe
command is needed, use Example: <test name="testGetUniqueSimple"> <var type="String" name="woNum">""</var> <mbo:getUniqueValue attribute="WONUM" object="WORKORDER" var="woNum" prefix="TEST"/> </test>Attributes
|
|||||||||||||||
mbo:parent |
Child of mbo:get and mbo:getSet
Attributes
|
|||||||||||||||
mbo:relationship |
Child of mbo:get and mbo:getSet
|
|||||||||||||||
mbo:setAttributeValue |
Sets a value to an attribute to identified by In order to handle the condition where the passed attribute
this method first gets the correct object and then assigns the value to the attribute of the right object. If the attribute Note: value of attribute will be changed to MBO which is in memory. In order to apply the changes to database, MBO must be saved. Example: <test name="testSetAttributeValueSimple"> <var type="MboRemote" name="wo">null</var> <var type="String" name="description"> "Testing mbo:setAttributeValue" </var> <mbo:get objectName="WORKORDER" var="wo"> <mbo:where> WONUM = '1000' </mbo:where> </mbo:get> <mbo:setAttributeValue name="DESCRIPTION" mbo="wo" value="description" /> </test>Attributes
|
|||||||||||||||
mbo:where |
Child of mbo:get and mbo:getSet
|
MIF Tags
mif:addListener |
Adds a MIF queue listener. Can only be used after the This command attaches a listener to the queue specified in the
Once the listener is attached, use the command
After use command Example: <!-- register listener --> <mif:listenProperties name="woListener" queue="jms/maximo/int/queues/sqout" filter="1047" type="text" consumeMessage="false" /> <!-- add listener --> <mif:addListener listenProperties="woListener" /> <!-- send a test message to the queue --> <mif:sendMessage externalSystem="DATAEXPORT" publishChannel="MXWOInterface" filePath="c:tempxmlfilesWOImportXML.xml" /> <!-- get message body --> <var type="String" name="woMessage"> null </var> <mif:waitForMessage timeOut="25" /> <mif:getMessageBody var="woMessage" /> <stringToFile content="$woMessage" filePath="c:tempwoMessage.txt"/>Attributes
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mif:checkCronTaskInstance |
Checks if Maximo Cron Task instance is valid. Checks if cron task instance is active and if it is reloaded. Also checks cron task instance parameters. Check MESSAGEPROCESSOR, QUEUENAME and TARGETENABLED parameters. If message processor class can not be initialized, queue that is placed in QUEUENAME property does not exists or TARGETENABLED property does not have one of (n,y,0,1) values then exception is thrown. Example: <mif:checkCronTaskInstance cronName="JMSQSEQCONSUMER" instanceName="SEQQIN"/>Attributes
|
||||||||||||||||||
mif:checkEjb |
Checks if MIF can process messages through EJB for given External System and Enterprise Service. Tries to initiate EJB and if initialization is unsuccessful exception is thrown. Example: <mif:checkEjb enterpriseService="MXWOInterface" externalSystem="EXTSYS1" jndiName="ejb/maximo/remote/enterpriseservice"/> or <mif:checkEjb jndiName="ejb/maximo/remote/enterpriseservice"/> <mif:checkEjb jndiName="ejb/maximo/remote/mosservice"/>Attributes
|
||||||||||||||||||
mif:checkEndPointHandler |
Checks if MIF End Point handler is valid. Depending on endpoint handler corresponding verifications are processed. For web service handler it first pings web services url and then checks if wsdl is deployed. Also checks if SOAP action is same in wsdl and endpoint property and if service name is same in endpoint property and wsdl file. For HTTP handler it pings URL. For XML file or Flat file handler it checks if FILEDIR property is set on endpoint. Checks if user has a permissions to write into folder that is specified in FILEDIR property of endpoint. For JMS handler sends test message into the queue and does roll-back after that. If there is any error during the sending of the message an exception is thrown. For IFACETABLE handler checks if interface table exists. If interface table is located on remote DB then checks connection to that DB and after that checks interface table existence. Method check if flat file is supported on enterprise service/publish channel for the specified interface table. For EJB handler checks EJB functionalities. Tries to initiate EJB and if initialization is unsuccessful exception is thrown. Note: If handler is IFACETABLE than it it must have child
element Example: <mif:checkEndPointHandler endPoint="MXIFACETABLE"> <mif:wsdl> http://localhost:9080/meaweb/wsdl/DATAEXPORT_MXWOInterface.wsdl </mif:wsdl> <mif:publishChannelName> MXWOInterface </mif:publishChannelName> </mif:checkEndPointHandler>Attributes
|
||||||||||||||||||
mif:checkEndPointOnExtSys |
Checks if MIF External System’s End Point is valid. Depending on endpoint handler corresponding verifications are processed. For web service handler it first pings web services url and then checks if wsdl is deployed. Also checks if SOAP action is same in wsdl and endpoint property and if service name is same in endpoint property and wsdl file. For HTTP handler it pings URL. For XML file or Flat file handler it checks if FILEDIR property is set on endpoint. Checks if user has a permissions to write into folder that is specified in FILEDIR property of endpoint. For JMS handler sends test message into the queue and does roll-back after that. If there is any error during the sending of the message an exception is thrown. For Interface table handler checks if interface table exists. If interface table is located on remote DB then checks connection to that DB and after that checks interface table existence. Method check if flat file is supported on enterprise service/publish channel where this interface table is placed. For EJB handler checks EJB functionalities. Tries to initiate EJB and if initialization is unsuccessful exception is thrown. Example: <mif:checkEndPointOnExtSys name="EXTSYS1"/>Attributes
|
||||||||||||||||||
mif:checkFlatFile |
Checks if MIF can process flat files for given External System and Enterprise Service. Imports XML file in preview mode. This means that file passes all business logic that is implemented for importing files, but at the end final step is not executed and file is not being imported into Maximo. Example: <mif:checkXmlFile enterpriseService="MXWOInterface" externalSystem="EXTSYS1" fileName="c:tempxmlfilesWOImportXML.xml"/>Attributes
|
||||||||||||||||||
mif:checkHttpChannel |
Checks if MIF HTTP port is open for given External System and Enterprise Service. Example: <mif:checkHttpChannel enterpriseService="MXWOInterface" externalSystem="EXTSYS1" url="http://localhost:9080/meaweb/esqueue/EXTSYS1/MXWOInterface"/>Attributes
|
||||||||||||||||||
mif:checkIfaceTable |
Checks if MIF can process interface table messages for given enterprise service. Example: <mif:checkIfaceTable enterpriseService="MXWOInterface"> <mif:interTransTbName>MX_WO_IFACE</mif:interTransTbName> </mif:checkIfaceTable>Attributes
|
||||||||||||||||||
mif:checkInContQueueOnExSys |
Checks if MIF External System’s inbound continues queue is set and valid. Tries to send message into inbound continuous queue. If there is any error exception is thrown. Message is rolled back if there is no exception during the sending. Example: <mif:checkInContQueueOnExSys name="DATALOADING"/>Attributes
|
||||||||||||||||||
mif:checkInSeqQueueOnExSys |
Checks if MIF External System’s inbound sequential queue is set and valid. Tries to send message into inbound sequential queue. If there is any error exception is thrown. Message is rolled back if there is no exception during the sending. Example: <mif:checkInSeqQueueOnExSys name="EXTSYS1"/>Attributes
|
||||||||||||||||||
mif:checkJmsQueue |
Checks if MIF JMS queue is valid for given External System and Enterprise Service. Depending on which inbound queue is used, it tries to send message into that queue. If there is any error exception is thrown. Message is rolled back if there is no exception during the sending. Example: <mif:checkJmsQueue enterpriseService="MXWOInterface" externalSystem="EXTSYS1"/>Attributes
|
||||||||||||||||||
mif:checkOutSeqQueueOnExSys |
Checks if MIF External System’s outbound sequential queue is set and valid. Tries to send message into outbound sequential queue. If there is any error exception is thrown. Message is rolled back if there is no exception during the sending. Example: <mif:checkOutSeqQueueOnExSys name="EXTSYS1"/>Attributes
|
||||||||||||||||||
mif:checkPublishChannelEndPoint |
Checks if MIF Publish Channel‘s End Point is valid. Depending on endpoint handler corresponding verifications are processed. For web service handler it first pings web services url and then checks if wsdl is deployed. Also checks if SOAP action is same in wsdl and endpoint property and if service name is same in endpoint property and wsdl file. For HTTP handler it pings URL. For XML file or Flat file handler it checks if FILEDIR property is set on endpoint. Check if user has a permissions to write into folder that is specified in FILEDIR property of endpoint. For JMS handler Sends test message into the queue and does roll-back after that. If there is any error during the sending of the message an exception is thrown. For Interface table handler Check if interface table exists. If interface table is located on remote DB then check connection to that DB and after that check interface table existence. Method check if flat file is supported on enterprise service/publish channel where is this interface table placed. For EJB handler Checks EJB functionalities. Tries to initiate EJB and if initialization is unsuccessful exception is thrown. Example: <mif:checkPublishChannelEndPoint name="MXWOInterface" externalSystemName="EXTSYS1"/>Attributes
|
||||||||||||||||||
mif:checkQueueMessageProcessing |
Checks if MIF queue is processing message. Tries to send message into specified queue. If there is any error exception is thrown. Message is rolled back if there is no exception during the sending. Example: <mif:checkQueueMessageProcessing name="jms/maximo/int/queues/sqout"/>Attributes
|
||||||||||||||||||
mif:checkWs |
Checks if MIF Web Service is responding for given External System and Enterprise Service. Checks web service inbound message processing. First pings web services url and then checks if wsdl is deployed. You can explicitly set read time-out and connection time-out using child elements
Example: <mif:checkWs webServiceURL="http://localhost:9080/meaweb/services/DATAEXPORT_MXWOInterface"/>Attributes
|
||||||||||||||||||
mif:checkXmlFile |
Checks if MIF can process XML files for given External System and Enterprise Service. Depending on which inbound queue is used, it tries to send message into that queue. If there is any error exception is thrown. Message is rolled back if there is no exception during the sending. Example: <mif:checkXmlFile enterpriseService="MXWOInterface" externalSystem="DATALOADING" fileName="c:\tempxmlfiles\WOImportXML.xml"/>Attributes
|
||||||||||||||||||
mif:configXMLPath | Not supported - do not use. | ||||||||||||||||||
mif:connTimeout |
Sets a connection time out in making the initial connection, i.e. completing the TCP connection handshake. Can only be used as an optional parameter within the Example: <mif:checkWs webServiceURL="http://localhost:9080/meaweb/services/EXTSYS1_MXWOInterface"> <mif:connTimeout>8</mif:connTimeout> </mif:checkWs> |
||||||||||||||||||
mif:cronTaskExist |
Checks if Maximo Cron Task exists. Example: <mif:cronTaskExist cronName="JMSQSEQCONSUMER"/>Attributes
|
||||||||||||||||||
mif:dataImport |
Imports XML message for given External System and Enterprise Service. To avoid database conflicts during imports, on critical fields in xml message file you can use $$#_ prefix so if the field is autokeyed its value will be moved to next, or if it is not, custom MaxTAF value will be set on that field. Example: <mif:dataImport filePath="c:\tempxmlfiles\WOImportXML.xml" enterpriseService="MXWOInterface" externalSystem="EXTSYS1"/>Attributes
|
||||||||||||||||||
mif:endPointExist |
Checks if MIF End Point exists. Example: <mif:endPointExist name="MXXMLFILE"/>Attributes
|
||||||||||||||||||
mif:enterpriseServiceExist |
Checks if MIF Enterprise Service exists. Example: <mif:enterpriseServiceExist name="MXWOInterface"/>Attributes
|
||||||||||||||||||
mif:enterServEnabled |
Checks if MIF External System’s Enterprise service is enabled. Example: <mif:enterServEnabled enterpriseService="MXWOInterface" externalSystem="EXTSYS1"/>Attributes
|
||||||||||||||||||
mif:enterServExistOnExtSystem |
Checks if MIF External System’s Enterprise Service exists on the specified external system. Example: <mif:enterServExistOnExtSystem enterpriseService="MXWOInterface" externalSystem="EXTSYS1"/>Attributes
|
||||||||||||||||||
mif:externalSystemEnabled |
Checks if the specified MIF external system is enabled. Example: <mif:externalSystemEnabled name="EXTSYS1"/>Attributes
|
||||||||||||||||||
mif:externalSystemExist |
Checks if the specified MIF external system exists. Example: <mif:externalSystemExist name="EXTSYS1"/>Attributes
|
||||||||||||||||||
mif:externalSystemName |
Checks if MIF External System exists. Tries to send message into inbound continuous queue. If there is any error exception a message is displayed. Transaction is rolled back if there is no exception during the sending. Example: <mif:checkInContQueueOnExSys name="EXTSYS1"/>Attributes
|
||||||||||||||||||
mif:fileSep |
Sets the separator character used in flat files. Can only be used as an optional parameter within following tags: checkFlatFile messageToMxFlatFile |
||||||||||||||||||
mif:getMessageBody |
Reads the message body after it has been received into the monitored queue. Example: <!-- add listener --> <mif:addListener listenProperties="woListener" /> <!-- send a test message to the queue --> <mif:sendMessage externalSystem="DATAEXPORT" publishChannel="MXWOInterface" filePath="c:tempxmlfilesWOImportXML.xml" /> <!-- get message body --> <var type="String" name="woMessage"> null </var> <mif:waitForMessage timeOut="25" /> <mif:getMessageBody var="woMessage" /> <stringToFile content="$woMessage" filePath="c:tempwoMessage.txt"/>Attributes
|
||||||||||||||||||
mif:httpConnTimeout |
Sets the time-out period in milliseconds before an HTTP connection is established. Can only be used as an optional parameter within the
|
||||||||||||||||||
mif:httpPassword |
Sets the password for the HTTP connection. Can only be used as an optional parameter within the
|
||||||||||||||||||
mif:httpProtocolVersion |
Specifies the version of the HTTP protocol for Web service invocations. The valid values are HTTP/1.0 and HTTP/1.1. If you do not provide a value, the system uses the default value, HTTP/1.1. |
||||||||||||||||||
mif:httpReadTimeout |
Specifies the read time-out value in milliseconds. Can only be used as an optional parameter within the
|
||||||||||||||||||
mif:httpUserName | Sets the HTTP user name if the HTTP basic authentication is enabled. | ||||||||||||||||||
mif:importInXMLFileMode |
Imports XML message. Copies file to MIF directory which is set in cron instance's SOURCEDIRECTORY parameter. Example: <mif:messageToMxXmlFile filePath="c:\tempxmlfiles\WOImportXML.xml" cronInstanceName="WORKORDER"/>Attributes
|
||||||||||||||||||
mif:interTransTbName |
Sets the interface transaction table name. Can only be used as an optional parameter within themessageToMxIfaceTable tag.
|
||||||||||||||||||
mif:listenProperties | Specifies parameters for a queue
listener.
Attributes
Example: <mif:listenProperties name="woListener" queue="jms/maximo/int/queues/sqout" filter="//*[name()='WONUM'][.='$wonum']" type="xpath" consumeMessage="false" /> <mif:addListener listenProperties="woListener" /> |
||||||||||||||||||
mif:mep | Specifies the message exchange pattern. | ||||||||||||||||||
mif:messageToMxEjb |
Sends message to Maximo using EJB for given Enterprise Service. Messages can be sent over enterprise service or the object structure. For the enterprise service, you must define
Example: <mif:messageToMxEjb enterpriseService="MXWOInterface" filePath="c:tempxmlfilesWOImportEJB.xml" jndiName="ejb/maximo/remote/enterpriseservice" sender="EXTSYS1"> <mif:methodName>processExternalDataAsync</mif:methodName> <mif:providerURL></mif:providerURL> <mif:userid></mif:userid> <mif:password></mif:password> </mif:messageToMxEjb> For the object structure you must define <mif:mosName> which is the object structure name as defined in Maximo. Example: <mif:messageToMxEjb enterpriseService="MXWOInterface" filePath="c:tempxmlfilesWOImportEJB.xml" jndiName="ejb/maximo/remote/mosservice" sender="EXTSYS1"> <mif:mosName>MXWO</mif:mosName> <mif:providerURL></mif:providerURL> <mif:userid></mif:userid> <mif:password></mif:password> </mif:messageToMxEjb>Attributes
|
||||||||||||||||||
mif:messageToMxFlatFile |
Sends flat file message to Maximo using specified external system and enterprise service. Note: If you don't use default file separator and text
qualifier, you can use optional child elements Example: <mif:messageToMxFlatFile filePath="c:tempxmlfilesWOImportFlat.dat" externalSystem="EXTSYS1" enterpriseService="MXWOInterface"/>Attributes
|
||||||||||||||||||
mif:messageToMxHttp |
Sends message to Maximo using HTTP. Note: You can set username and password using child elements:
Example: <mif:messageToMxHttp enterpriseService="MXWOInterface" filePath="c:tempxmlfilesWOImportHTTP.xml" url="http://localhost:9080/meaweb/esqueue/EXTSYS1/MXWOInterface"/>Attributes
|
||||||||||||||||||
mif:messageToMxIfaceTable |
Imports message using interface table for given External System and Enterprise Service. Note: Optional properties (url, intertrans table, username, password, driver) can be set using child elements:
Example: <mif:messageToMxIfaceTable filePath="c:tempxmlfilesWOImportXML.xml" enterpriseService="MXWOInterface" externalSystem="EXTSYS1" isRemote="true"/>Attributes
|
||||||||||||||||||
mif:messageToMxJmsQueue |
Imports message directly trough JMS queue for given External System and Enterprise Service. Example: <mif:messageToMxJmsQueue filePath="c:tempxmlfilesWOImportXML.xml" externalSystem="EXTSYS1" enterpriseService="MXWOInterface"/>Attributes
|
||||||||||||||||||
mif:messageToMxWebService |
Imports message through web service. Example: <mif:messageToMxWebService serviceName="EXTSYS1_MXWOInterface" filePath="c:tempxmlfilesWOImportXML.xml" webServiceURL="http://localhost:9080/meaweb/services/EXTSYS1_MXWOInterface" soapAction="processDocument" > <mif:utUser>MAXADMIN</mif:utUser> <mif:httpReadTimeout>20000</mif:httpReadTimeout> <mif:httpConnTimeout>20000</mif:httpConnTimeout> </mif:messageToMxWebService>Attributes
|
||||||||||||||||||
mif:messageToMxXmlFile |
Imports XML message. Copies file to MIF directory which is set in cron instance's SOURCEDIRECTORY parameter. Example: <mif:messageToMxXmlFile filePath="c:\tempxmlfiles\WOImportXML.xml" cronInstanceName="WORKORDER"/>Attributes
|
||||||||||||||||||
mif:methodName |
Sets the connection method. Can only be used as a property tag within themessageToMxEjb tag.
|
||||||||||||||||||
mif:mosName |
Sets the interface name. Can only be used as a child element within themessageToMxEjb tag.
|
||||||||||||||||||
mif:password |
Sets the password. Can only be used as an optional parameter within the following tags:
messageToMxIfaceTable
|
||||||||||||||||||
mif:providerUrl |
Sets the url of the application server where the enterprise bean is located. Can only be used as an optional parameter within themessageToMxEjb tag.
|
||||||||||||||||||
mif:publishChannelEnabled |
Checks if MIF External System’s Publish Channel is enabled. Example: <mif:publishChannelEnabled name="MXWOInterface" externalSystemName="EXTSYS1"/>Attributes
|
||||||||||||||||||
mif:publishChannelEventListenerEnabled |
Checks if MIF Publish Channel’s event listener is enabled. Example: <mif:publishChannelEventListenerEnabled name="MXWOInterface"/>Attributes
|
||||||||||||||||||
mif:publishChannelExist |
Checks if MIF Publish Channel exists. Example: <mif:publishChannelExist name="MXWOInterface"/>Attributes
|
||||||||||||||||||
mif:publishChannelExistOnExternalSystem |
Checks if MIF External System’s Publish Channel exists. Example: <mif:publishChannelExistOnExternalSystem name="MXWOInterface" externalSystemName="EXTSYS1"/>Attributes
|
||||||||||||||||||
mif:publishChannelName |
Sets the publish channel name. Can only be used as a child element within the
|
||||||||||||||||||
mif:queueExist |
Checks if MIF queue exists. Example: <mif:queueExist name="jms/maximo/int/queues/sqin"/>Attributes
|
||||||||||||||||||
mif:queueName |
Checks if MIF queue is processing message. Tries to send message into specified queue. If there is any error exception is thrown. Message is rolled back if there is no exception during the sending. Example: <mif:checkQueueMessageProcessing name="jms/maximo/int/queues/sqout"/>Attributes
|
||||||||||||||||||
mif:sendMessage | Checks if MIF can send message for
given External System and Publish Channel.
Attributes
|
||||||||||||||||||
mif:textQualifier |
Sets the start and end character which denotes a text section. Can only be used as an optional parameter within thecheckFlatFile
tag.
|
||||||||||||||||||
mif:url |
Sets the URL value. Can only be used as an optional parameter within the messageToMxIfaceTable tag. |
||||||||||||||||||
mif:userid |
Sets the user ID. Can only be used as an optional parameter within following tags:
|
||||||||||||||||||
mif:userName |
Sets the user name. Can only be used as an optional parameter within the messageToMxIfaceTable tag. |
||||||||||||||||||
mif:utPassword | Not supported - do not use. | ||||||||||||||||||
mif:utUser | Not supported - do not use. | ||||||||||||||||||
mif:waitForMessage | Sets the time to wait for a message to
appear in the queue.
Attributes
|
||||||||||||||||||
mif:wsAddrVersion |
Sets the web service addressing version. Can only be used as an optional parameter within the
|
||||||||||||||||||
mif:wsdl |
Sets the WSDL url. Can only be used as an optional child tag within thecheckEndPointHandler tag.
|
UI Tags
ui:assertElementPresent |
Element that checks if specified element is somewhere on the page. Must match only one child element that is returned by the selector. Selectors:
Example: <ui:assertElementPresent> <ui:xpath>//span[@id='mx47']/span/span[3]</ui:xpath> </ui:assertElementPresent> |
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
ui:assertText |
Element that checks if certain text is equal to text content of web element. Must have one and only one child element that represent selector by which element will be found. Example: <ui:assertText text="Go To"> <ui:xpath>//span[@id='mx47']/span/span[3]</ui:xpath> </ui:assertText>Attributes
|
|||||||||
ui:assertTextPresent |
Checks if certain text appears somewhere on the rendered page. Example: Attributes
|
|||||||||
ui:assertTitle |
Element that checks if certain text is equal to title of the current page. Example: <ui:assertTitle title="Work Order Tracking" />Attributes
|
|||||||||
ui:assertValue |
Element that checks if certain text is equal to a value of an input web element. Must have one and only one child element that is returned by the selector. Selectors:
Example: <!-- when a work order is created, Maximo should auto-populate the Class field with value "WORKORDER" --> <ui:assertValue value="WORKORDER"> <ui:xpath>//*[@staticId='main_grid3_2-textbox_textbox']</ui:xpath> </ui:assertValue>Attributes
|
|||||||||
ui:changeApp |
Opens the specified application. Name must be a valid Maximo application name. Example: <ui:changeApp name="startcntr" /> Attributes
|
|||||||||
ui:clear |
Clears a text field. Example: <ui:clear> <ui:xpath>//*[@staticId='changestatus_grid1_1_1_grid4_3a-textbox_textbox']</ui:xpath> </ui:clear> |
|||||||||
ui:click |
Performs a click on an element. Used mostly to click link elements on the page. Example: <addReportLine action="Click Change Status button" expected="Change Status dialog is displayed" actual="Change Status dialog is displayed" status="PASSED" /> <ui:click> <ui:xpath>//*[@staticId='toolactions_button_14-toolbarbutton_image_image']</ui:xpath> </ui:click> |
|||||||||
ui:clickEvent |
Directly executes Maximo java script function Example: <!-- sendEvent click --> <ui:clickEvent> <ui:xpath>//*[@staticId='plans_children_table-table_expand_contract']"</ui:xpath> </ui:clickEvent> |
|||||||||
ui:clickSimple |
Clicks on element by performing native click event. This is a stripped down version of Example: <!-- simple click --> <ui:clickSimple> <ui:xpath>//*[@staticId='plans_children_table-table_expand_contract']"</ui:xpath> </ui:clickSimple> |
|||||||||
ui:close |
Closes the connection to the web driver. Automatically added to a UI test within the
Example: <ui:close/> |
|||||||||
ui:createDriver |
Creates a connection to the web driver. When a UI test is created this is automatically inserted into thebeforeTestCase tag.
|
|||||||||
ui:executeScript |
Executes JavaScript on the test page. Can interact with existing JavaScript created by the test logic. Example: <ui:executeScript jsCode="warnExit=false" />Attributes
|
|||||||||
ui:getAttribute |
Gets attribute value of web element. Must match only one child element represented by the selector. Example: <var type="String" name="descAttribute">""</var> <ui:getAttribute var="descAttribute" name="id"> <ui:xpath>//*[@staticId='headerA_5-multiparttextbox_textbox_2']</ui:xpath> </ui:getAttribute> <addReportLine action="Get Description field ID" expected="ID is retrieved" actual="id: $descAttribute" status="PASSED" />Attributes
|
|||||||||
ui:getText |
Gets text content of web element (for example a label text) and stores it into a variable. Must match only one child element returned by the selector. Example: <var type="String" name="elemText">""</var> <ui:getText var="elemText"> <ui:xpath>//span[@id='mx47']/span/span[3]</ui:xpath> </ui:getText> <addReportLine action="Get element text" expected="Element text can be fetched" actual="Element text is $elemText" status="PASSED" />Attributes
|
|||||||||
ui:getTextPresent |
Checks if certain text appears somewhere on the rendered page. Returned value is stored into the referenced variable. Example: <var type="String" name="elemTextPresent">""</var> <ui:getTextPresent text="o To" var="elemTextPresent" /> <addReportLine action="Checking if text is present on the page" expected="Element text is present on the page" actual="Element text is present: $elemTextPresent" status="PASSED" />Attributes
|
|||||||||
ui:getTitle |
Checks if certain text is equal to title of the current page. Stores returned value into the specified variable if the page title is the same as the specified title text. Example: <var type="String" name="pageTitle">""</var> <ui:getTitle title="Work Order" var="pageTitle" /> <addReportLine action="Checking page title" expected="Page title is Work Order" actual="Page title is $pageTitle" status="PASSED" />Attributes
|
|||||||||
ui:getValue |
Gets value of text input element. Must match only one element returned by the selector. Example: <var type="String" name="woNum">""</var> <ui:getValue var="woNum"> <ui:xpath>//*[@staticId='headerA_5-multiparttextbox_textbox_1']</ui:xpath> </ui:getValue> <addReportLine action="Getting work order number" expected="Work Order number can be fetched" actual="WONUM is $woNum" status="PASSED" />Attributes
|
|||||||||
ui:getVerificationErrors |
Returns verification errors and prints report lines for them. Works with verify tags (for example: |
|||||||||
ui:javaScriptExecutor |
Provides access to the mechanism for executing JavaScript. Created automatically by the UI test within the Example: <beforeTestCase> <ui:createDriver> <ui:timeout>120</ui:timeout> </ui:createDriver> <ui:javaScriptExecutor/> <addReporter type="xml" name="Test Title" description="Test Description" class="Test Class" author="Autor"></addReporter> </beforeTestCase> |
|||||||||
ui:login |
Log in user with specified username and password. If no username or password is specified, test parameters will be used. Example: <ui:login> <ui:userName>maxadmin</ui:userName> <ui:password>maxadmin</ui:password> </ui:login> |
|||||||||
ui:logout |
Log out the current user. Example: <ui:logout /> |
|||||||||
ui:maximizeWindow |
Maximizes the browser window. Example: <ui:maximizeWindow /> |
|||||||||
ui:openApp |
Deprecated - use Opens the specified application. Name must be a valid Maximo application name. Example: <ui:openApp name="startcntr"></ui:openApp>Attributes
|
|||||||||
ui:screenshot |
Captures a screenshot of the page and stores it into the specified file. File name must conform to file naming convention of the OS. Example: <ui:screenshot file="screenshot.jpg" />Attributes
|
|||||||||
ui:sendKeys |
Simulates typing into a text input web element. Must match only one child element that is returned by the selector. Example: <ui:sendKeys text="test"> <ui:xpath>//*[@staticId='headerA_5-multiparttextbox_textbox_2']</ui:xpath> </ui:sendKeys> <addReportLine action="Enter 'test' as description" expected="Description is populated" actual="Description is populated" status="PASSED" />Attributes
|
|||||||||
ui:sendParam |
Sends the test parameter value to specified field. Example: <!-- sendParam --> <ui:sendParam name="paramName"> <ui:xpath>//*[@staticId='plans_children_table-table_expand_contract']"</ui:xpath> </ui:sendParam>Attributes
|
|||||||||
ui:setInnerHTML |
Sets the element's inner html. Replaces any html found in the element located. Example: <ui:setInnerHTML> <ui:id>dijitEditorBody</ui:id> <ui:content> <![CDATA[testing <span style="font-weight: bold;">setInnerHTML</span><br>using different <span style="font-family: monospace;">font </span><br>and <span style="text-decoration: underline;"><span style="font-weight: bold;">style </span></span><br><div></div> ]]></ui:content> |
|||||||||
ui:switchToDefaultFrame |
Switches focus to the main frame of the page. Mostly used to return from iFrame previously focused on. Example: <!-- clicking on element inside iFrame with xpath "//*[@id='uploadIFrame']/span[2]/span" and returning to default frame --> <ui:switchToFrame> <ui:xpath>//*[@id='uploadIFrame']</ui:xpath> </ui:switchToFrame> <ui:click> <ui:xpath>//*[@id='uploadIFrame']/span[2]/span</ui:xpath> </ui:click> </ui:switchToDefaultFrame/> |
|||||||||
ui:switchToFrame |
Switches focus to the specified frame. Mostly used for interaction with elements in iFrames. Example: <!-- clicking on element inside iFrame with xpath "//*[@id='uploadIFrame']/span[2]/span" and returning to default frame --> <ui:switchToFrame> <ui:xpath>//*[@id='uploadIFrame']</ui:xpath> </ui:switchToFrame> <ui:click> <ui:xpath>//*[@id='uploadIFrame']/span[2]/span</ui:xpath> </ui:click> </ui:switchToDefaultFrame/> |
|||||||||
ui:switchToMainWindow |
Switches control to the main window. Main window is the window in which the test started running. Example: <ui:switchToMainWindow closeCurrent="true" />Attributes
|
|||||||||
ui:switchToWindow |
Switches control to different window with specified title. If Example: <ui:switchToWindow title="BIRT Report Viewer" closeCurrent="false" />Attributes
|
|||||||||
ui:verifyElementPresent |
Verifies if specified element is somewhere on the page. Must match only one element returned by the selector. Example: <ui:verifyElementPresent> <ui:xpath>//span[@id='mx47']/span/span[3]</ui:xpath> </ui:verifyElementPresent> |
|||||||||
ui:verifyText |
Verifies if certain text is equal to text content of web element. Must match only one child element that is returned by the selector. Example: <ui:verifyText text="o To"> <ui:xpath>//span[@id='mx47']/span/span[3]</ui:xpath> </ui:verifyText>Attributes
|
|||||||||
ui:verifyTextPresent |
Verifies if certain text appears somewhere on the rendered page. Example: <ui:verifyTextPresent text="o To" />Attributes
|
|||||||||
ui:verifyTitle |
Verifies that the title of the page matches the specified title text. Example: <ui:verifyTitle title="Work Order" />Attributes
|
|||||||||
ui:verifyValue |
Verifies if specified text is equal to value of input web element. Must match only one element returned by the selector. Example: Attributes
|
|||||||||
ui:wait |
Sets a time out period in the execution of the test. Will pause execution of the subsequent tag for the given
period of time (expressed in seconds in the Example: <ui:click> <ui:xpath>//*[@staticId='headerA_5-multiparttextbox_textbox_2']</ui:xpath> </ui:click> <ui:wait time="30" /> <ui:clear> <ui:xpath>//*[@staticId='headerA_5-multiparttextbox_textbox_2']</ui:xpath> </ui:clear>Attributes
|
|||||||||
ui:waitForElementPresent |
Verifies a matched element will show up on the page in the specified number of seconds. Must match only one element returned by the selector. Example: <ui:waitForElementPresent time="30"> <ui:xpath>//*[@staticId='headerA_5-multiparttextbox_label']</ui:xpath> </ui:waitForElementPresent>Attributes
|
|||||||||
ui:waitForText |
Verifies if specified text will be equal to text content of web element in specified number of seconds. Must match only one element returned by the selector. Example: <ui:waitForText text="Originating Record:" time="30"> <ui:xpath>//*[@staticId='main_grid9_1-textbox_label']</ui:xpath> </ui:waitForText>Attributes
|
|||||||||
ui:waitForTextPresent |
Verifies if certain text appears somewhere on the rendered page in the specified number of seconds. Example: <ui:waitForTextPresent text="Originating Record:" time="30" />Attributes
|
|||||||||
ui:waitForTitle |
Verifies if specified text will be equal to the rendered page title in the specified number of seconds. Example: <ui:waitForTitle title="Work Order" time="30" />Attributes
|
|||||||||
ui:waitForUserAction |
Pauses the test execution and wait for the user action defined in the "action" sub-command. Example: <ui:waitForUserAction> <ui:message>message to show</ui:message> <ui:action> <!-- action to execute, for test to continue --> <!-- use ONLY ONE of the following --> <ui:clickContinue/> <ui:clickElement> <ui:id>element_to_be_clicked_id</ui:id> </ui:clickElement> </ui:action> </ui:waitForUserAction> |
|||||||||
ui:waitForValue |
Verifies if the specified text will be equal to the value of an input element in the specified number of seconds. Example: <ui:waitForValue value="WORKORDER" time="10"> <ui:xpath>//*[@staticId='main_grid3_2-textbox_textbox']</ui:xpath> </ui:waitForValue>Attributes
|
DB Tags
db:closeConnection |
Closes opened database connection defined by Example: <db:closeConnection connection = "myConnection"/>Attributes
|
|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
db:connection |
Creates a connection to database. Example: <var type="Connection" name="myConnection">null</var> <db:connection var="myConnection"> <db:url>jdbc:oracle:thin:@//localhost:1521/max1</db:url> <db:password>maximo</db:password> <db:userName>maximo</db:userName> <db:driver>oracle.jdbc.driver.OracleDriver</db:driver> </db:connection>Attributes
|
|||||||||||||||
db:driver |
Database driver. Example: <db:driver>oracle.jdbc.driver.OracleDriver</db:driver> |
|||||||||||||||
db:forEachResult |
Loops through given result set and fetches records. For each fetched record the nested child elements will be processed. Example: <db:forEachResult resultSet="rs"> <var name="result1" type="String"> null </var> <db:getStringFromResult fieldName="WONUM" var="result1"/> <printOut> result1 </printOut> </db:forEachResult> Within this element you can use elements which get values from the current record. Those elements are:
Attributes:
Example: <var name="result1" type="String"> null </var> <db:getStringFromResult fieldName="WONUM" var="result1"/>
Attributes:
Example: <var name="resultInt" type="int"> 0 </var> <db:getIntFromResult fieldName="ESTMATCOST" var="resultInt"/>
Attributes:
Example: <var name="resultDate" type="int"> 0 </var> <db:getIntFromResult fieldName="PMDUEDATE" var="resultDate"/>
Attributes:
Example: <var name="resultTimestamp" type="Timestamp"> null </var> <db:getTimestampFromResult fieldName="STATUSDATE" var="resultTimestamp"/>
Attributes:
Example: <var name="resultLong" type="long"> 0 </var> <db:getLongFromResult fieldName="WORKORDERID" var="resultLong"/>
Attributes:
Example: <var name="resultFloat" type="float"> 0 </var> <db:getFloatFromResult fieldName="WOPRIORITY" var="resultFloat"/>
Attributes:
Example: <var name="resultBoolean" type="boolean"> false </var> <db:getBooleanFromResult fieldName="WOACCEPTSCHARGES" var="resultBoolean"/>
Attributes:
Example: <var name="resultClob" type="Clob"> null </var> <db:getClobFromResult fieldName="LDTEXT" var="resultClob"/>
Attributes:
Example: <var name="resultBlob" type="Blob"> null </var> <db:getBlobFromResult fieldName="RESOURCES" var="resultBlob"/>
Attributes:
Example: <var name="resultBytes" type="byte[]"> null </var> <db:getBytesFromResult fieldName="RESOURCES" var="resultBytes"/>
Attributes:
Example: <var name="resultByte" type="byte"> 0 </var> <db:getByteFromResult fieldName="ASSETLOCPRIORITY" var="resultByte"/>Attributes
|
|||||||||||||||
db:getBlobFromResult |
Child of db:forEachResult
Attributes
|
|||||||||||||||
db:getBlobFromResultSet |
Gets BLOB value from record identified by given row number from given result set. Example: <var name="resultBlob" type="Blob"> null </var> <db:getBlobFromResultSet resultSet="rs" field="RESOURCES" row="1" var="resultBlob"/>Attributes
|
|||||||||||||||
db:getBooleanFromResult |
Child of db:forEachResult
Attributes
|
|||||||||||||||
db:getBooleanFromResultSet |
Gets boolean value from record identified by given row number from given result set. Example: <var name="resultBoolean" type="boolean"> false </var> <db:getBooleanFromResultSet resultSet="rs" field="WOACCEPTSCHARGES" row="1" var="resultBoolean"/>Attributes
|
|||||||||||||||
db:getByteFromResult |
Child of db:forEachResult
Attributes
|
|||||||||||||||
db:getByteFromResultSet |
Gets byte value from record identified by given row number from given result set. Example: <var name="resultByte" type="byte"> 0 </var> <db:getByteFromResultSet resultSet="rs" field="ASSETLOCPRIORITY" row="1" var="resultByte"/>Attributes
|
|||||||||||||||
db:getBytesFromResult |
Child of db:forEachResult
Attributes
|
|||||||||||||||
db:getBytesFromResultSet |
Gets bytes value from record identified by given row number from given result set. Example: <var name="resultBytes" type="byte[]"> null </var> <db:getBytesFromResultSet resultSet="rs" field="RESOURCES" row="1" var="resultBytes"/>Attributes
|
|||||||||||||||
db:getClobFromResult |
Child of db:forEachResult
Attributes
|
|||||||||||||||
db:getClobFromResultSet |
Gets CLOB value from record identified by given row number from given result set. Example: <var name="resultClob" type="Clob"> null </var> <db:getClobFromResultSet resultSet="rs" field="LDTEXT" row="1" var="resultClob"/>Attributes
|
|||||||||||||||
db:getDateFromResult |
Child of db:forEachResult
Attributes
|
|||||||||||||||
db:getDateFromResultSet |
Gets Date value from record identified by given row number from given result set. Example: <var name="resultDate" type="Date"> null </var> <db:getDateFromResultSet resultSet="rs" field="PMDUEDATE" row="1" var="resultDate"/>Attributes
|
|||||||||||||||
db:getFloatFromResult |
Child of db:forEachResult
Attributes
|
|||||||||||||||
db:getFloatFromResultSet |
Gets float value from record identified by given row number from given result set. Example: <var name="resultFloat" type="float"> 0 </var> <db:getFloatFromResultSet resultSet="rs" field="WOPRIORITY" row="3" var="resultFloat"/>Attributes
|
|||||||||||||||
db:getIntFromResult |
Child of db:forEachResult
Attributes
|
|||||||||||||||
db:getIntFromResultSet |
Gets integer value from record identified by given row number from given result set. Example: <var name="resultInt" type="int"> 0 </var> <db:getIntFromResultSet resultSet="rs" field="ESTMATCOST" row="1" var="resultInt"/>Attributes
|
|||||||||||||||
db:getLongFromResult |
Child of db:forEachResult
Attributes
|
|||||||||||||||
db:getLongFromResultSet |
Gets long value from record identified by given row number from given result set. Example: <var name="resultLong" type="long"> 0 </var> <db:getLongFromResultSet resultSet="rs" field="WORKORDERID" row="1" var="resultLong"/>Attributes
|
|||||||||||||||
db:getStringFromResult |
Child of db:forEachResult
Attributes
|
|||||||||||||||
db:getStringFromResultSet |
Gets string value from record identified by given row number from given result set. Example: <var name="resultString" type="String"> null </var> <db:getStringFromResultSet resultSet="rs" field="WONUM" row="1" var="resultString"/>Attributes
|
|||||||||||||||
db:getTimestampFromResult |
Child of See documentation for
|
|||||||||||||||
db:getTimestampFromResultSet |
Gets Date value from record identified by given row number from given result set. Example: <var name="resultTimestamp" type="Timestamp"> null </var> <db:getTimestampFromResultSet resultSet="rs" field="STATUSDATE" row="1" var="resultTimestamp"/>Attributes
|
|||||||||||||||
db:password |
Database password. Example: <db:password>maximo</db:password> |
|||||||||||||||
db:sql |
SQL to execute on specified DB connection. Returned result set is stored into variable. Example: <var type="ResultSet" name="rs">null</var> <db:sql connection="dataLoaderConn" var="rs"> select * from staging_asset </db:sql> |
|||||||||||||||
db:url |
Database URL, holds database connect string. Example: <db:url>jdbc:oracle:thin:@//localhost:1521/max1</db:url> |
|||||||||||||||
db:userName |
Database username. Example: <db:userName>maximo</db:userName> |
NET Tags
net:checkURLResponseCode |
Test response code for given URL. Example: <net:checkURLResponseCode url="http://www.google.com" responseCode="200"/>Attributes
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
net:getURLResponseCode |
Returns response code from given URL. Example: <var name="response" type="int">0</var> <net:getURLResponseCode url="http://www.google.com" var="response"/>Attributes
|
|||||||||
net:ping |
Test the reachability of a host on an Internet Protocol (IP) network. Example: <net:ping host="192.168.1.5"/> For testing reachability of port on a host, you can use <net:port> child element. Example: <net:ping host="192.168.1.5"> <net:port>139</net:port> </net:ping>Attributes
|
|||||||||
net:port |
Child of net:ping .
|
TIME Tags
time:dateVar |
Child of time:getFormatedTime .
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
time:getCurrentMinute |
Returns the number of minutes past the hour. Example: <var type="int" name="minute">0</var> <time:getCurrentMinute var="minute"/>Attributes
|
|||||||||
time:getCurrentSecond |
Returns the number of seconds past the minute. Example: <var type="int" name="second">0</var> <time:getCurrentSecond var="second"/>Attributes
|
|||||||||
time:getDayOfMonth |
Returns the day of the month. Returned value is number. Example: <var type="int" name="dayOfMonth">0</var> <time:getDayOfMonth var="dayOfMonth"/>Attributes
|
|||||||||
time:getDayOfWeek |
Returns the day of the week. Returned value is number in interval 1-7 (starting with sunday). Example: <var type="int" name="dayOfWeek">0</var> <time:getDayOfWeek var="dayOfWeek"/>Attributes
|
|||||||||
time:getFormatedTime |
Formats a Date into a date/time string using the given date and time pattern. Returns date/time string. By default it use current system time. Example: <var type="String" name="formatedTime">null</var> <time:getFormatedTime var="formatedTime" format="dd-mm-yyyy hh:mm:ss"/> If you don't want to use current system time, you can pass the Date instance by using Example: <time:getFormatedTime var="formatedTime1" format="dd-mm-yyyy hh:mm:ss"> <time:dateVar>time</time:dateVar> </time:getFormatedTime>Attributes
|
|||||||||
time:getHourOfDay |
Gets the current hour. Returned value is a number. Example: <var type="int" name="hourOfDay">0</var> <time:getHourOfDay var="hourOfDay"/>Attributes
|
|||||||||
time:getMonth |
Returns a number representing the current month. Returned number id in interval 0-11 (starting with January). Example: <var type="int" name="month">0</var> <time:getMonth var="month"/>Attributes
|
|||||||||
time:getSeconds |
Transforms milliseconds to seconds. Example: <var name="mills" type="long">2017</var> <var type="float" name="sec">0</var> <time:getSeconds milliseconds="mills" var="sec"/>Attributes
|
|||||||||
time:getTime |
Returns a Date object representing current time value. Example: <var type="Date" name="time">null</var> <time:getTime var="time"/>Attributes
|
|||||||||
time:getYear |
Returns the current year. Example: <var type="int" name="year">0</var> <time:getYear var="year"/>Attributes
|
|||||||||
time:stopwatchResume |
Resume the stopwatch after a suspend. The watch will not include time between the suspend and resume calls in the total time. Example: <time:stopwatchResume name="stopwatch1"/>Attributes
|
|||||||||
time:stopwatchSplit |
Returns time passed since starting stopwatch. Returned time is in milliseconds. Example: <var name="split1" type="long">0</var> <time:stopwatchSplit name="stopwatch1" var="split1"/>Attributes
|
|||||||||
time:stopwatchStart |
Starts a new timing session. Attribute name represents the name of variable that will hold the stopwatch instance(Variable must be created before using this element and its type must be Example: <var name="stopwatch1" type="StopWatch">null</var> <time:stopwatchStart name="stopwatch1"/>Attributes
|
|||||||||
time:stopwatchStop |
Stop the stopwatch (ends the timing session) and returns time in millisecond. Example: <var name="stop1" type="long">0</var> <time:stopwatchStop name="stopwatch1" var="stop1"/>Attributes
|
|||||||||
time:stopwatchSuspend |
Suspend the stopwatch for later resumption. Example: <time:stopwatchSuspend name="stopwatch1"/>Attributes
|
|||||||||
time:wait |
Stops the test thread for a specified number of seconds. Example: <time:wait period="5"/>Attributes
|
WF Tags
wf:completeAssignment |
Completes the assignment for the user, workflow, object combination. States whether the assignment is accepted or declined. Example: <test name="testInitiateWorkflow"> <mbo:get objectName="WORKORDER" var="wo">lt;mbo:where>WONUM = 'GT500'lt;/mbo:where>lt;/mbo:get> <wf:hasAssignment user="smith" object="wo" process="WOAPPROVE" /> <wf:completeAssignment user="smith" object="wo" process="WOAPPROVE" memo="Completed by WF1 test" accepted="true" /> </test>Attributes
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wf:getUser |
Retrieves Maximo user object for the user specified in the attribute Example: <test name="testUser"> <!-- make user object based on input parameter --> <var name="user" type="psdi.security.UserInfo">null</var> <var name="userName" type="String">null</var> <getTestParam name="user" variable="$userName"/> <wf:getUser userName="$userName" var="$user"/> </test>Attributes
|
||||||||||||||||||
wf:hasAssignment |
Confirms that the user has an assignment for the given object and workflow. Example: <test name="testInitiateWorkflow"> <mbo:get objectName="WORKORDER" var="wo">lt;mbo:where>WONUM = 'GT500'lt;/mbo:where>lt;/mbo:get> <wf:hasAssignment user="smith" object="wo" process="WOAPPROVE" /> </test>Attributes
|
||||||||||||||||||
wf:hasAssignmentOnNode |
Confirms that the user has an assignment for the given object, node name and workflow. Example: <test name="testInitiateWorkflow"> lt;mbo:get objectName="WORKORDER" var="wo">lt;mbo:where>WONUM = 'GT500'lt;/mbo:where>lt;/mbo:get> lt;wf:hasAssignmentNode user="smith" object="wo" process="WOAPPROVE" nodeName="FIN APPR1" /> </test> Attributes
|
||||||||||||||||||
wf:hasAssignmentOnNodeId |
Confirms that the user has an assignment for the given object, node name and workflow. Example: <test name="testInitiateWorkflow"> lt;mbo:get objectName="WORKORDER" var="wo">lt;mbo:where>WONUM = 'GT500'lt;/mbo:where>lt;/mbo:get> lt;wf:hasAssignmentNode user="smith" object="wo" process="WOAPPROVE" nodeName="FIN APPR1" /> </test> Attributes
|
||||||||||||||||||
wf:initiateWorkflow |
Initiates given workflow process for the given MBO. Example: <test name="testInitiateWorkflow"> <mbo:get objectName="WORKORDER" var="woOriginal">lt;mbo:where>WONUM = 'GT500'lt;/mbo:where>lt;/mbo:get> <mbo:duplicate var="wo" original="woOriginal" /> <wf:initiateWorkflow name="WOAPPROVE" object="wo"/> </test>Attributes
|
||||||||||||||||||
wf:stopWorkflow |
Stops the workflow on the given object. Example: <test name="testInitiateWorkflow"> <mbo:get objectName="WORKORDER" var="wo">lt;mbo:where>WONUM = 'GT500'lt;/mbo:where>lt;/mbo:get> <wf:hasAssignment user="smith" object="wo" process="WOAPPROVE" /> <wf:completeAssignment user="smith" object="wo" process="WOAPPROVE" memo="Completed by WF1 test" accepted="true" /> <wf:stopWorkflow object="wo" memo="Stopped Workflow by Test Script" process="WOAPPROVE"/> </test>Attributes
|
Building Custom Elements
You can extend MXML functionality by building your own xml elements.
- Java
- Maximo customisation
- XML
- XSD
As mentioned in other parts of this manual, MaxTAF MXML elements are abstractions of Java code. In simple terms, when MXML script is compiled, for every element in the script, MaxTAF takes the associated Java code template, replaces the attributes' values in the template and appends the result to the Java code.
For example, the following MXML element
<getTestParam name="compMasterName" variable="$compMasterName" />compiles into the following Java code:
{ if(testProperties==null){ testProperties = new TestProperties(params); } if(testProperties.getProperties().getProperty("compMasterName")==null){ testReport.addTestStepReport("Getting test property","Getting test property with name: "+"compMasterName","Test property not found!","FAILED"); status = "FAILED"; throw new NoTestPropertyException("There is no test property with name: "+"compMasterName"); } compMasterName = testProperties.getProperties().getProperty("compMasterName"); }To extend MXML with your own elements, you need to perform the following 2 tasks:
- Create/program Java template
- Set the XSD definition for the element
File Organization
Both the Java template file and the XSD definition file are kept in the MaxTAF directory structure. This is very convenient when developing new elements as you can work in real-time without having to deploy or compile.
Your Java template file, also known as the Commands file, must
be located in <maxtaf_root>/mxml/commands directory. You
can name the file anyway you like but its extension must be XML, e.g
myco.xml
.
Your XSD file must be located in <maxtaf_root>/mxml/xsd
directory. You can also name this file anyway you like but with
extension .xsd, e.g. myco.xsd
.
Additionally, when you are first starting with building extensions, you
also must register your XSD extension file in the file ext.xsd
that is located in the <maxtaf_root>/mxml/xsd. To register the
file insert the following tag with the xs:schema
tag:
<xs:include schemaLocation="xsd_file_name"/>
Where:
xsd_file_name
is the file name of your XSD file, e.g. myco.xsd
.
Commands Definition
The Java code template for your extension element is held in the Commands file (see previous). This file is an XML file. Your new element is defined with the following XML structure:
<ext:element_name xmlns:ext="http://www.maxtaf.com/ext"> <attributes> <attribute name="attribute_name" type="attribute_type"/> </attributes> <begin> ...opening_code... </begin> ...main_code... <ext:sub_element name...></ext:sub_element> <end> ...closing_code... </end> <imports> <import> java_import </import> </imports> <exceptions> <exception>java_exception</exception> </exceptions> <ext:element_name>
Where:
element_name
is the name of your element. You can use any
name as long as it does not clash with an existing element. It is
strongly recommended that you prefix all of your elements with a unique
prefix e.g. myco_
and thus avoid possible collisions with extended
elements produced by other developers/teams/vendors.
attribute_name
is the name of an attribute of your
element. You can use any name for your attribute.
attribute_type
is the type of your attribute. It has to
be a valid XSD type.
opening_code
is the top part of your Java code
main_code
is all of your Java code in cases when you
don't need to split your code. Therefore you either use begin
and end
tags and keep your code there, or you place all of your
code in the main_code
area.
sub_element
is one or many MXML ext:element
structures
that are nested inside the main code. They follow the exact same rules
as for the main element. Through your element's XSD definition in the
XSD file, you can control whether you want to allow one or many repeats
of these sub-elements and whether they are optional or mandatory. The
code of the sub-elements is always nested between the begin
and
end
segments.
closing_code
is the very bottom segment of your Java
code.
java_import
is a Java import declaration needed for the
element's Java code, e.g. psdi.app.workorder.WORemote
.
java_exception
is a Java exception declaration needed for
the element's Java code, e.g. MXException
.
How It Works
MXML compiler works by first making a temporary copy of each of Java code template segments (begin, main or end). It then, for every segment and for every attribute of the element, replaces the attribute place-holders with attribute values. Once done, it appends the resulting string to the previously processed Java code.
Attribute place-holders are marked with $
sign. E.g. if we have
an attribute memo
, then its place-holder in the template segment will
be $memo
.
Additionally, the content of the import
elements will be added
to the import declarations of the over-all test case class. If another
element has already declared the same import, then the import will be
ignored. Similarly, the Exception
elements will be added to the
exception declarations of the test method.
Example
In this example, we want to build work order change status tag. The tag
will have tree attributes: wonum
, siteid
and status
.
Additionally, the tag will have an optional element memo
. This
is what it should look like when used in the test:
<ext:myCo_woChangeStatus wonum="TESTWO1" status="APPR" siteid="BEDFORD"> <ext:memo>approve memo</ext:memo> </ext:myCo_woChangeStatus>
When compiled, we want this code to convert to the following Java code:
{ String mycoStatus = "APPR"; String mycoMemo=""; MboSetRemote mycoWoSet = MXServer.getMXServer().getMboSet("WORKORDER", MXServer.getMXServer().getSystemUserInfo()); mycoWoSet.setWhere("wonum = '" + "TESTWO1" + "' and siteid = '" + "BEDFORD" + "'"); mycoWoSet.reset(); WORemote mycoWo = (WORemote) mycoWoSet.getMbo(0); mycoMemo="approve memo"; mycoWo.changeStatus(mycoStatus, MXServer.getMXServer().getDate(), mycoMemo); mycoWoSet.save(); }
Commands code
Here is a complete commands code that achieves this functionality:
<ext:myCo_woChangeStatus xmlns:ext="http://www.maxtaf.com/ext"> <!-- declare attributes --> <attributes> <attribute name="wonum" type="String"/> <attribute name="status" type="String"/> <attribute name="siteid" type="String"/> </attributes> <!-- top section of the Java code. Note how the attribute place-holders are prefixed with $ --> <begin> { String mycoStatus = $status; String mycoMemo=""; MboSetRemote mycoWoSet = MXServer.getMXServer().getMboSet("WORKORDER", MXServer.getMXServer().getSystemUserInfo()); mycoWoSet.setWhere("wonum = '" + $wonum + "' and siteid = '" + $siteid + "'"); mycoWoSet.reset(); WORemote mycoWo = (WORemote) mycoWoSet.getMbo(0); </begin> <!-- Defintion of the optional sub-element memo. If present, it will be inserted before the end section and after the begin section --> <ext:memo> <attributes> <attribute name="content" type="String"/> </attributes> mycoMemo=$content; </ext:memo> <!-- bottom section of Java code --> <end> mycoWo.changeStatus(mycoStatus, MXServer.getMXServer().getDate(), mycoMemo); mycoWoSet.save(); } </end> <!-- imports declaration --> <imports> <import> java.rmi.RemoteException </import> <import> psdi.util.MXException </import> <import> psdi.mbo.MboRemote </import> <import> psdi.server.MXServer </import> <import> psdi.mbo.MboSetRemote </import> <import> psdi.mbo.StatefulMboRemote </import> <import> psdi.app.workorder.WORemote </import> </imports> <!-- exception declaration --> <exceptions> <exception>RemoteException</exception> <exception>MXException</exception> </exceptions> </ext:myCo_woChangeStatus>
XSD definition
Our new element needs to be accompanied with its XSD definition. The XSD definition for this element looks like this:
<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.maxtaf.com/ext" xmlns:tns="http://www.maxtaf.com/ext" elementFormDefault="qualified" attributeFormDefault="unqualified"> <element name="myCo_woChangeStatus" type="tns:tMyCo_woChangeStatus"></element> <complexType name="tMyCo_woChangeStatus"> <sequence> <element name="memo" minOccurs="0" maxOccurs="1"> <simpleType> <restriction base="string"> <minLength value="0"></minLength> </restriction> </simpleType> </element> </sequence> <attribute name="wonum" use="required"> <simpleType> <restriction base="string"> <minLength value="0"></minLength> </restriction> </simpleType> </attribute> <attribute name="status" use="required"> <simpleType> <restriction base="string"> <minLength value="0"></minLength> </restriction> </simpleType> </attribute> <attribute name="siteid" use="required"> <simpleType> <restriction base="string"> <minLength value="0"></minLength> </restriction> </simpleType> </attribute> </complexType> </schema>
Element registration and File structure
Let's say that we want to keep all of our custom tags in files called
after our company: myco
. In that case, we will have the command
definitions file myco.xml
. This file will hold the content of the XML
code from the above section Commands code and it must be kept
in the maxtaf/mxml/commands directory.
The XSD content from the above section XSD Definition will be
kept in a file named myco.xsd
and must be located in the
maxtaf/mxml/xsd directory.
Lastly, if we haven't done so before, we must register our XSD file. We do so by editing the file maxtaf/mxml/xsd/ext.xsd where we insert the following code:
<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:tns="http://www.maxtaf.com/ext" xmlns:t="http://www.maxtaf.com" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.maxtaf.com/ext" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:include schemaLocation="myco.xsd"/> </xs:schema>
In summary, we have added/updated the following files:
maxtaf/mxml/command/myco.xml maxtaf/mxml/xsd/ext.xsd maxtaf/mxml/xsd/myco.xsd
Usage
That's all. Once you have completed the above steps, you can
immediately start using your new element myCo_woChangeStatus
in your
MXML tests.
Using Include Tag
In the MXML tests you can reuse the same test segment by utilising the include
tag.
When the test is compiled, first the include
tag is physically replaced with the content of the file that it is pointing to
and then it gets compiled as one big test.
The resulting effect is the same as if you copy-pasted the content of the file into your test.
The benefit of include
tag is that you maintain the code that is shared between many different tests in one place only.
To use this tag, first you need to extract the test segment into a separate file.
<segment xmlns:ui="http://www.maxtaf.com/ui"> <ui:login></ui:login> <ui:changeApp name="wotrack"/> <!-- [ click ] button - New Work Order --> <ui:click> <ui:xpath>//img[@staticId='toolactions_button_0-toolbarbutton_image_image']</ui:xpath> </ui:click> <!-- [ click ] toolbarbutton - Save Work Order --> <ui:click> <ui:xpath>//a[@staticId='toolactions_button_1-toolbarbutton_image_anchor']</ui:xpath> </ui:click> <!-- [ click ] button - Approve Work Order --> <ui:click> <ui:xpath>//img[@staticId='toolactions_button_14-toolbarbutton_image_image']</ui:xpath> </ui:click> <!-- [ click ] pushbutton --> <ui:click> <ui:xpath>//button[@staticId='changestatus_2_1-pushbutton_pushbutton']</ui:xpath> </ui:click> </segment>
In the above example, we have the test segment that we want to reuse.
Like all well-formed XML documents, tags we extracted need to be inside the root tag, called segment
.
segment
tag.
Once you created your new file, you can use it in any test by referencing it in the path
attribute of the include
tag.
<testCase xmlns="http://www.maxtaf.com" name="Includetest" xmlns:ui="http://www.maxtaf.com/ui" xmlns:mif="http://www.maxtaf.com/mif" xmlns:mbo="http://www.maxtaf.com/mbo" xmlns:time="http://www.maxtaf.com/time" xmlns:net="http://www.maxtaf.com/net" xmlns:wf="http://www.maxtaf.com/wf" xmlns:db="http://www.maxtaf.com/db" xmlns:ext="http://www.maxtaf.com/ext" > <beforeTestCase> <ui:createDriver> <ui:timeout>120</ui:timeout> </ui:createDriver> <ui:javaScriptExecutor/> <addReporter type="xml" name="Test Title" description="Test Description" class="Test Class" author="Autor"/> </beforeTestCase> <test name="testInclude"> <addTestReport name="testInclude"/> <ui:maximizeWindow /> <include path="C:/ibm/SMP/maximo/maxtaf/template/woCreate.xml" /> <!-- [ assertValue ] textbox - Status: APPR --> <ui:assertValue value="APPR"> <ui:xpath>//input[@staticId='headerA_8-textbox_textbox']</ui:xpath> </ui:assertValue> <testReportStatus>PASSED</testReportStatus> </test> <afterTestCase> <ui:close/> <closeReporter/> </afterTestCase> </testCase>
You can also call include file from another include file. Just bare in mind that your test will not compile if you create a loop in your calling hierarchy (first include file calls the second; second include file calls the first).
UI Tests
MaxTAF framework runs JUnit tests and as such can be used to execute any browser automation tests that can be embedded into a JUnit class.
However, MaxTAF provides specific support for the Selenium framework, both in the functional extensions and the knowledge base.
Static Element Id
When constructing a web page, for performance reasons, Maximo assigns dynamic id's to the page elements. These dynamic id's follow the format mxnnn where nnn is a sequential integer number. Being dynamically generated, these id's are not exclusively assigned to specific elements. E.g. if the New Status element in the dialog Change Status has id of mx1234 when you first open the dialog, it will become something else next time you open the same dialog, like mx9876.
This behaviour makes the browser automation tests rather difficult as it forces the developer to devise other ways of identifying screen elements, like using complicated xpath expressions or similar. Additionally, after every Maximo upgrade, the dynamic ID's are likely to change making the old tests obsolete.
Maximo 7.5 and later offers a system property called staticid
,
which if switched on, permanently assigns static id's to elements,
again in the format mxnnnnnn. Although this function resolves
automation problem, it comes with a pay-off on performance level.
MaxTAF resolves this problem by introducing functionality that
adds static element id's, but only when a test demands it. Hence, the
performance benefits of dynamic id's is still available for regular use
of the software. When switched on, the MaxTAF will create a new
attribute called staticId
to accompany every dynamic id. The value of
the staticId
element attribute will be the element's id as specified in
the application’s presentation XML, basically, the id that you see when
in the Application Designer you look at the properties of a screen
element.
Example:
In the following example, you can see that the id
attribute for
the New Status field has changed after the status dialog was
re-opened from mx3788 to mx3354. However, the staticId
attribute
added by MaxTAF filter has stayed the same :
changestatus_grid1_1_1_grid4_1-combobox_textbox
. (The tool used to
display element properties in these examples is the Firebug plug-in
for Firefox browser. You can, of course, use any tool of your choice.)
figure 1: New Status element after first invocation of the change status dialog
figure 2: New Status element after the second invocation of the change status dialog
Activating MaxTAF Static Id
Method 1:
MaxTAF static id is activated through the page url parameter static. If at the end of your Maximo page url you add static=y and reload the page, from that point onward, for the given user session, all the elements with dynamic id’s will also have their static id's as explained above.
Example:
http://localhost:9080/maximo/ui/?event=loadapp&value=wotrack&uisessionid=5&static=y
Once activated, the staticId will be present only for the
duration of the user session, meaning that it will be switched off as
soon as the session is ended. Therefore you must activate staticid
for
every new session, in essence, after every new login into Maximo. From
testing perspective this means that the test code, when launching the
browser, must add static=y at the end of the Maximo URL.
Method 2:
You can permanently switch on the static id by having the
property global.static
set to "1", in the MaxTAF Administration
module.
To switch global static off, either set it to "0" or delete it.
Note: Be aware that assigning static id’s to page elements inevitably requires certain amount of computing power so in performance critical environments you should always use method 1 to activate static id's.
UI Test Parameters
When running Selenium tests in MaxTAF, you have to specify parameters that will enable MaxTAF to issue instructions to the web browser via Selenium facilities.
These parameters can be specified as MaxTAF properties in the
MaxTAF Administration application or can be explicitly supplied as test
parameters for individual tests. If both exist, the test parameter will
take precedence.
selenium.
e.g. selenium.mode
or
selenium.maximoAddress
MaxTAF UI test parameters list:
mode
- Determines whether the browser will be launched locally (on the Maximo server) or at a specified remote URL.
Values: remote or localbrowser
- Determines the type of browser to be launched
Values: internetexplorer or firefoxmaximoAddress
- Full http address for your Maximousername
- Maximo username that will be used for test sessionpassword
- Maximo password that will be used for test session
If you wish to restrict the visibility of this value, set it up as MaxTAF property, and then restrict access to MaxTAF Administration applicationremoteSelenesServerAddress
- Full http address to your Selenium Server.
You can install Selenium server anywhere you like as long as your Maximo server can see that addressslowDownLevel
- Determines the speed of the script execution. The higher the level, the slower the execution. Value of this parameter represents the number of seconds waited before the next UI action is executed.timeOut
- The amount of time, in seconds, that the test waits for specified UI element if it is not immediately present.
Example of UI test parameter list:
mode=remote browser=firefox #browser=internetexplorer remoteSelenesServerAddress=http://localhost:5555/wd/hub maximoAddress=http://localhost:3280/maximo username=maxadmin password=maxadmin slowDownLevel=0
MaxTAF Recorder
Selenium IDE is a plug-in module for FireFox browser that provides many options including the Record and Play functionality.
MaxTAF Recorder is an add-on for Selenium IDE that extends Selenium IDE functionality with the following:
- MaxTAF selector: when recording, the Selenium Recorder is
instructed to use the MaxTAF
staticid
element attribute as the main identification method for page elements.
- MaxTAF Formatters: export recorded Selenium sessions into ready-to-run MaxTAF java classes or XML files for test import .
MaxTAF Recorder Test Parameters
UI test case parameters, discussed in the section UI Test Parameters, can be defined directly in Selenium IDE. The parameter values set in the Selenium IDE will be exported with the test script itself. Importing the test script into Maximo, will populate the parameter list of that test case with the values defined.
To define the values of these parameters in your Selenium IDE go to Options > Options... > Formats and then select any format starting with MaxTAF / Import.
All of the export formats that can be imported directly into Maximo has its own parameter list to define. When you install the Selenium IDE plug-in and MaxTAF extension plug-in, this list will be populated with default values as seen on the image above.
To change any of the defined values, simply type new value into the desired field, and click on the OK button. If you want the parameter changed to be the same across all the export formats, then repeat this procedure for all the MaxTAF / Import formats.
Recording UI Tests
Recording new UI tests consists of :
- Recording your Maximo UI session using the Selenium IDE.
- Exporting the recorded script from IDE into Maximo
- Open the List screen of the Maximo application you want to test.
- If not on, switch the static mode on (see Activating MaxTAF Static Id)
- When ready to record, launch SeleniumIDE
By default, when launched, the SeleniumIDE goes straight into the Record mode. In case you notice that no recording is happening, switch it on manually by clicking the red circle in the upper right corner of the SeleniumIDE window. - Now perform your session in Maximo that you wanted to record. As you click and type around, SeleniumIDE will capture your screen actions and convert them into instructions.
- When done, press the record button to stop recording
Exporting the Recorded Test To Maximo
- In Selenium IDE, choose File > Export Test Case as.. menu option.
- Choose MaxTAF / Import / MXML option.
- Save the export file.
The file name you choose at this step will be the name of the MaxTAF test case. You must not name the file test (it is a reserved word) and also, you must not start the file name with a number but must start with a letter.
- You can save your file to a destination of your choice. Then you import the file, by using the action Import Test Case from the List tab of the Test Case application.
Assuming that your MaxTAF import facilities are correctly set up and active, if you save the recorded session directly into the <maxtafdir>\import directory, the test will be instantly imported and will immediately show up in the MaxTAF > Test Case application in Maximo.
That's it. Now if you go to MaxTAF > Test Case application and search for a test case with the same name as was your export file, it should show up on the list.
Open this record, and if all is set-up correctly and your Selenium Server is up and running, you should be able to run the Test Case immediately
In addition to the MXML export format, you can also choose:
- MaxTAF / Import / Java
- MaxTAF / Java
- MaxTAF / Import / Custom
MaxTAF / Import / Java creates an import file, which when imported into Maximo, creates a Test Case of type Java. These tests have only the Java code and not the MXML code.
MaxTAF / Java creates a file which only contains the Java code of the test. This cannot be imported into Maximo but rather copy-pasted into the Script editor.
MaxTAF / Import / Custom creates an import file using custom formatter. The custom formatter extends the standard MaxTAF / Import / MXML formatter, which can then be customised by the client with client's specific functionality.
Running UI Tests
Running Selenium tests is no different to running ordinary MaxTAF tests. The following must be in place:
- MaxTAF test parameters are set to the correct values (see section Selenium parameters)
- Selenium server is up and running
The press of the Run Test button will kick
The press of the Run Test button will kick off the Selenium test and a new browser session will be launched by the Selenium server and the test will commence (pay attention to your task bar to see the launch of a new browser session).
Recorder and BIRT reports
The testing of Maximo BIRT reports predominantly consists of asserting the correctness of the data present in the report. When recording your test, you will run the report, and when the output is produced and presented in its separate window, you will use the right click menu options like "assert" and "validate" to evaluate the correctness of a specifc report element (e.g. that the sum total at the bottom of the page is of a specific value, or that the status of a specific work order in the report table is APPR).
The elements in BIRT reports do not have static ids like the elements in other Maximo screens. Consequently, the tests cannot locate the elements in BIRT reports by using the unique identifiers (static id). Instead, the recorder will by default capture the elements position on the page, e.g. 3rd cell of the 2nd row in the 4th table in on the page. This position will be then used to locate the element when we play the test.
However, for the assertion of the data contained within a table, this is not always a reliable way of identifying data elements as their row position within the table is most likely to vary between different runs of the report due to data being added or deleted between runs.
MaxTAF Recorder solves this problem by emulating the way that a human tester locates the data in the report tables.
Let's consider an example of a "Word Order Details" report shown below.
Say that one of the test steps is to assert that the status of the task with id "30" is "INPRG". For a person to check manually the status, the natural proccess would be to first find the row of the table for the "Task ID" = "30" and then look for the value of the "Status" column for that row and confirm that it is "INPRG". For MaxTAF Recorder to emulate this thought process, in addition to asserting the value of the Status cell, it also needs to know which column holds the unique identifier of that row, namely the "Task ID" column in this specific example.
In MaxTAF terminology this column is called Key Column and the Recorder requires you to specify it once the table is interacted with (clicked/right-clicked on). In this example, once you right click the "Status" cell in the table, a popup dialog will show, requesting you to specify the "Key Column name". At this stage, you will type in the "Task ID" and press OK button.
Once the valid column name is entered the dialog will disappear and you can continue with your intended action,
e.g. the right-click menu will show up, and you can then select the "assertText" command.
This proccess of Key Column definition is required only once per report table.
Once you've defined the Key Column, the header of that column will be highlighted.
It is possible to change the Key Column for a report table by right clicking anywhere in the table and selecting "changeReportKeyColumn" command.
The functionallity explained above is used by default when recording in the BIRT report window.
If you wish to have a choice whether or not to use this functionallity,
you can change the value of the "Switch to BIRT report locators automatically?" checkbox in the "General" tab of the Recorder options.
If this option is turned off, then the Recorder will prompt the user for the decision while recording.
Test Case Parameters
At the run time, the content of the screen element Parameters will be passed on to the JUnit test class.
MXML:
The test case parameters in MXML have to be in the properties format. This is a standard format for Java properties files where each line holds a name-value pair for a specific property e.g :
siteId=EAGLENA
woPrefix=TESTWO
To get the content of a specific property, use the
getTestParam
tag:
<var name="prefix" type="String">""</var> <var name="mySiteId" type="String">""</var> <getTestParam name="woPrefix" variable="prefix" /> <getTestParam name="siteId" variable="mySiteId" />
In this example, the value that the user sets in the Test Case
screen, namely EAGLENA for the site id and TESTWO for the work
order prefix will be transferred into the mySiteId
and prefix
MXML
variables.
JUnit:
In JUnit test cases, to get the content of the Parameters field, the test class must include a static variable named params:
public static String params;
The precise format of the content of this variable is entirely down to the programmer. For example, it can contain a single value or can contain an XML or properties structures with multiple values.
Example 1: single value
public static String params; … String wonum=params;
Example 2: properties format
public static String params; public static Properties p = new Properties(); … p.load(new ByteArrayInputStream(params.getBytes());); String wonum = p.get("WO").toString(); String ponum = p.get("PO").toString();
Data Driven Tests
Data Driven tests are those that enable repeat execution of the test case but with a different set of predefined test case parameters for each run.
The data sets for the data driven test run are held in the CSV format (comma separated values) in a text file.
Data File:
The data file can be either attached to the Test Case record (via Maximo file attachment) or can be located as a file on a drive that is visible to Maximo.
You specify your data file as a test case parameter.
For the Maximo attachments, the data file is specified in the following
test case parameter:
testData.csvAttachment=attachment_namewhere
attachment_name
is the name you gave to your attachment when attaching the file to the
test case record.
For the data files located on a drive, the data file is specified in
the following test case parameter:
testData.csvFilePath=file_pathwhere
file_path
is the full path to your file.
Columns:
You need to specify the mapping between your data values and the test
case input parameters. For this you use function
dataSource(column_reference)where
column_reference
can be either the title of the column, when such is specified in the
first row of the file, or the column's number/position (see below).
To assign this value to a test input parameter, you simply add a line in your test case parameters in the following format:
input_parameter=dataSource(column_reference)
Example:
Say, that we are testing changing the status of a work order and our data file attached to our test case, under the name of WOCHANGESTATUS, contains the work order number and the status that the work order needs to change to. Your WOCHANGESTATUS data file could look like this:
"WONUM","STATUS" "WO123","APPR" "WO345","COMP"
We expect that our on execution of our test case, the test case is executed twice, first time with data of the first data row and the second time from the second row.
Our test case input parameters would look like this:
testData.csvAttachment=WOCHANGESTATUS woNum=dataSource("WONUM") newStatus=dataSource("WONUM")
With this set-up, our test case will be executed twice. The first time, woNum input parameter will be set to WO123 and the newStatus will be set to APPR. The second time round, woNum and newStatus will be set to WO345 and COM, respectively.
So, in preparation for the execution of a test case, the system will read the data file. For each row in the data file, it will parse the CSV formatted text and separate data items into column variables. It will then replace column variables in the test case input parameters with their values and will only then execute the test case.
Ways of addressing the data file values in the test case parameters:
1. By Column Title:
If your data file has titles of the columns
in the first row then you can address the value from that column in the
test case parameters by entering
dataSource("data_column_name")Example:
dataSource("WONUM")
data_column_name
with
double quotes.
2. By Column Position:
If your data file does not have titles of
the columns, i.e. the first row contains data. then you can address the
value from that column in the test case parameters by entering
dataSource(data_column_number)
Where
data_column_number
means the columns position in the data file .
Example:
dataSource(3)
data_column_number
with quotes.
2. By Fixed Position:
You can also address a value of a specific
cell in the data file
dataSource(data_row_number, data_column_number)Where
data_column_number
means the cell's column position in the data file, and the
data_row_number
means the cell's row position in the data file.
Example:
dataSource(4,2)
In this case, MaxTAF will always use the value of the second column in the fourth row for all iterations of the test case run.
Running Iterations in Parallel:
By default, the execution of the test cases is sequential, meaning that for each row of test data, MaxTAF will execute the test cases one at a time.MaxTAF also allows simultaneous execution of test cases for all the data rows in the file. To do so, you specify the following parameter in the test case input parameters:
testData.parallel=trueWith this set-up, MaxTAF will launch parallel threads, each one representing a row in the data file.
Reports
MaxTAF provides flexible facilities for reporting on the progression and the outcome of test runs.
The reports can be in a simple text format, or they can be XML or HTML documents.
In addition to fully constructing and controlling the output in
your test class, you can also use the Reporter
class which provides
ready made templates for some of the most common test reporting needs.
How It Works?
The mechanism in place is fairly simple: during the execution of
a report, the developer can store any feedback information in a static
string variable called report
. Upon the completion, the full content
of this variable is saved with the test run log.
When presenting the test run log in the Test application, the following logic applies:
- if the
report
content starts with <?xml it will be categorised as an XML document - if the
report
content contains <html> it will be categorised as an HTML document - if neither of the above, it will be categorised as a TEXT document
When presenting the report, its content together with the content type label will be passed on to a browser control on the screen which will then render it according to its type.
With this understanding, you can make any reports you like, from simple text reports to complex HTML documents with style sheets, transformations etc.
Using Reports In Tests
Although you have the full freedom to develop your own reports and report templates, MaxTAF comes with a predefined set of classes and interfaces for most common test reporting needs.They are used to construct report in XML format. The XML file is then transformed to HTML using XSLT.
Below is a report example. The XML is transformed into HTML using default XSL and CSS. It has header with a title, description, test class, author, test date and status.
After the header there is information about every test executed (in this case only one), with the steps for the test.
There are three interfaces which define the construction of the report XML:
Reporter
- for working with XML itself, such as
converting XML to string, applying XSL to XML, setting the header
information etc.
TestReport
- contains methods for manipulation of particular
test report. Note that JUnit allows you to have multiple tests within a
test class, and therefore you can have multiple test reports.
TestStep
- contains the methods for the manipulation of a
particular test step (part of test report)
MaxTAF comes with implementations of these interfaces:
Reporter
, TestReport
and TestStep
classes. Of course, you can
define your own implementations.
Here is how to use these classes:
First you have to initiate Reporter
class. The most logical
place to do it is in a method annotated either with @BeforeClass
or @Before
(for more information see Table 1. Annotations),
reporter = new Reporter(String title, String description, String className, String author, Date date)
If you wish, after you have initiated Reporter
, you can set-up
your own custom XSL with the following line of code:
reporter.setXSL(“http://my_xsl_location/my.xsl”);
Otherwise default XSL will be used.
For every test in the test class you have to initiate
TestReport
object with its constructor:
public CdlTestReport(String testName);
Then you can add individual test steps with:
TestStep addTestStepReport(String number, String action, String expected, String actual, String status);
This method returns an instance of the TestStep
class. This
class holds information on a specific test step in the report.
The value of the attribute “Status” that shows the pass/fail outcome of
the step can be controlled through the method setStatus(String status)
:
TestStep myTestStep = myTest.addTestStepReport("1", "Create new work order", "New work order is created", "New work order is created", "UNKNOWN"); // // your code which creates new work order // myTestStep.setStatus("PASSED");
Finally, you have to convert Reporter XML to a string and put it
in the static variable report
. Best place for doing this is in a
method with @AfterClass
or @After
annotations (for more information see
Table 1. Annotations). In this method you should also define the status
of whole test case:
reporter.setStatus("PASSED"); report = reporter.getXMLString();
Customizing Report XSL and CSS
As mentioned you can create your own XML transformation and style sheet for the report XML.
The logic is as follows: Reporter will produce an XML output. That XML will point to the XSL transformation file. The XSL transformation will name the CSS style sheet.
In order to customise the report you will produce your own
version of the XSL which will point to your own CSS style sheet file.
Then in your MaxTAF test code you will associate your XSL with the
report using the aforementioned method setXSL();
Below are examples of the default XML, XSL and CSS files used by MaxTAF.
XML:
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="TestReport.xsl"?> <test> <header> <title>Company Master UI Test</title> <description>Test checking if creation of company master records and creation of companies works</description> <class>rs.cdl.maxtaf.test.CompanyMasterTestUI</class> <author>John Doe</author> <date>22/3/2012</date> </header> <method name="createCompanyMaster1"> <step number="1" action="Log in to Maximo" expected="The Maximo Main Menu will be displayed." actual="As expected" status="Passed" /> <step number="2" action="From the Equipment Module select the Equipment Application." expected="As expected" actual="The Equipment Application screen is displayed." status="Passed" /> <step number="4" action="Click on the ‘Associate Specification Template’ button" expected="The Associate Specification Template screen will be displayed" actual="As expected" status="Passed" /> </method> <method name="createCompanyMaster2"> <step number="1" action="Log in to Maximo" expected="The Maximo Main Menu will be displayed." actual="As expected" status="Passed" /> <step number="2" action="From the Equipment Module select the Equipment Application." expected="As expected" actual="The Equipment Application screen is displayed." status="Passed" /> <step number="4" action="Click on the ‘Associate Specification Template’ button" expected="The Associate Specification Template screen will be displayed" actual="As expected" status="Passed" /> </method> </test>
XSL:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <header> <link rel="stylesheet" type="text/css" href="TestReport.css" /> <title> <xsl:value-of select="testcase/header/title" /> </title> </header> <body> <h1> <xsl:value-of select="testcase/header/title" /> </h1> <table class="header"> <tr> <td class="title"> Description </td> <td> <xsl:value-of select="testcase/header/description" /> </td> </tr> <tr> <td class="title"> Test Class </td> <td> <xsl:value-of select="testcase/header/class" /> </td> </tr> <tr> <td class="title"> Author </td> <td> <xsl:value-of select="testcase/header/author" /> </td> </tr> <tr> <td class="title"> Date </td> <td> <xsl:value-of select="testcase/header/date" /> </td> </tr> <tr> <td class="title"> Status </td> <xsl:if test="testcase/header/status='PASSED'"> <td class="passed"> <xsl:value-of select="testcase/header/status" /> </td> </xsl:if> <xsl:if test="testcase/header/status='FAILED'"> <td class="failed"> <xsl:value-of select="testcase/header/status" /> </td> </xsl:if> </tr> </table> <br /> <xsl:for-each select="testcase/test"> <h2> Test: <xsl:value-of select="@name" /> </h2> <table class="steps"> <tr> <th>Step</th> <th>Action</th> <th>Expected Result</th> <th>Actual Result</th> <th>Status</th> </tr> <xsl:for-each select="step"> <tr> <td> <xsl:value-of select="@number" /> </td> <td> <xsl:value-of select="@action" /> </td> <td> <xsl:value-of select="@expected" /> </td> <td> <xsl:value-of select="@actual" /> </td> <xsl:if test="@status='PASSED'"> <td class="passed"> <xsl:value-of select="@status" /> </td> </xsl:if> <xsl:if test="@status='FAILED'"> <td class="failed"> <xsl:value-of select="@status" /> </td> </xsl:if> </tr> </xsl:for-each> </table> <br /> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet>
and the CSS file:
body { font-family: arial, sans serif, verdana; font-size: 12px; padding: 0 10px 10px 10px; } h1 { font-family: verdana, arial, sans serif; color: #333300; font-weight: bold; font-size: 125%; } h2 { font-family: verdana, arial, sans serif; color: #999999; font-weight: bold; font-size: 125%; } table.header { border: 1px solid; margin: 0; padding: 0; border-collapse: collapse; } table.header tr { border: 1px solid black; } table.header tr td { border: 1px solid black; color: black; margin: 0; padding: 5px; } table.header tr td.title { background-color: #666699; border: 1px solid black; font-weight: bold; color: white; margin: 0; padding: 5px; text-transform: uppercase; } table.steps { border: 1px solid; margin: 0; padding: 0; border-collapse: collapse; } table.steps tr { border: 1px solid black; } table.steps tr th { background-color: #333300; border: 1px solid black; color: white; margin: 0; padding: 5px; text-transform: uppercase; } table.steps tr td { border: 1px solid black; color: black; margin: 0; padding: 5px; } table.header tr td.passed { font-weight: bold; color: green; } table.header tr td.failed { font-weight: bold; color: red; }
There are three places where you can keep your XSL and CSS files:
1. in Maximo Doclinks folder
2. in the EAR file in MaximoUIWeb/WebClient directory
3. at an external internet location
API Variables: Data Sharing Between Suite Tests
MaxTAF enables independent tests that belong to the same test suite, to exchange information during the suite run.
This is particularly useful when tests are logically sequenced. Example: the first test in a suite creates a work order and the second test approves the work order. The work order number is auto generated by Maximo, so you need to pass the generated work order number from the first test to the second test in order for the second test to know which work order to approve.
MXML:
In MXML test cases, use apInput
and apiOutput
tags.
These tags are used for exchanging values between test cases in a
suite.
The apiOutput
takes the value of the variable specified
in the var
attribute and passes it on to the next test case in the
test suite.
The apiInput
tag takes on the value of the apiOutput
tag from the
preceding test case in a test suite and assigns it to the variable
specified in the var
attribute.
Example:
1) The first test case fills the apiOutput
variable with the
newly created Work Order number:
<apiOutput var="newWoNum"/>
2) The subsequent test receives the wonum through apiInput
mechanism and puts it in the woNum variable for later use:
<var type="String" name="woNum">null</var> <apiInput var="woNum"/>
JUnit:
In java test cases, the test class can include the two
specialized Object variables called apiInput
and apiOutput
:
public static Object apiInput; public static Object apiOutput;
At a suite run, the value of the apiOuput
variable of the
previous test will be passed into the apiInput
variable of the
next test.
For example the first test can have the following code:
MboRemote myWo = myWoSet.add(); apiOutput = myWo;
and the second test can have:
MboRemote woToApprove = apiInput;
If you need to pass more than one object, you
can use various Java collections on offer, like ArrayList
.
REST API
REST API is part of Maximo Intergation framework, which allows for external application integration.
MaxTAF supports execution of existing test cases and retrieval of test run logs through REST, by using standard HTTP POST method.
Executing Test Case
To execute existing test case, send POST request to the following URL:
http://maximoaddress/maxrest/rest/mbo/cdlmtestrunlog
where
maximoaddress
should be your Maximo URL (eg. localhost:9080/maximo).
It is required for the POST request to include the following HTTP header:
x-http-method-override:runTestThis header annotates the method executed, which in this case is
runTest
method.
Accepted POST parameters are:
_lid
- Maximo login username (required)_lpwd
- Maximo login password (required)~testNum
- Test case to execute (required)~params
- Temporary test case parameters (optional)
By using request parameter ~params
you can override existing test case parameters. These parameters are temporary and will not be saved in the test case.
Parameters sent through request must be URL encoded. Example:
~params=mode%%3Dremote%%0Abrowser%%3Dfirefox%%0AremoteSelenesServerAddress%%3Dhttp%%3A%%2F%%2Flocalhost%%3A5555%%2Fwd%%2Fhub%%0AmaximoAddress%%3Dhttp%%3A%%2F%%2Flocalhost%%3A3680%%2Fmaximo%%0Ausername%%3Dmaxadmin%%0Apassword%%3Dmaxadmin%%0AslowDownLevel%%3D0%%0AcompMasterName%%3DtestREST
To URL encode parameter list (like the one in the test case parameter field) you can use online URL Encoder/Decoder from here.
Complete test execution example:
Content of the batch file that uses CURL library to execute POST request:
start curl -d "_lid=maxadmin&_lpwd=maxadmin&~testNum=companymasterui&~params=mode%%3Dremote%%0Abrowser%%3Dfirefox%%0AremoteSelenesServerAddress%%3Dhttp%%3A%%2F%%2Flocalhost%%3A5555%%2Fwd%%2Fhub%%0AmaximoAddress%%3Dhttp%%3A%%2F%%2Flocalhost%%3A3680%%2Fmaximo%%0Ausername%%3Dmaxadmin%%0Apassword%%3Dmaxadmin%%0AslowDownLevel%%3D0%%0AcompMasterName%%3DtestREST" --header "x-http-method-override:runTest" http://localhost:9080/maxrest/rest/mbo/cdlmtestrunlog
COMPANYMASTERUI
test case.
Response from the POST request is the test run log in XML format. The response is identical to the report log that you can find and export from Test Case application.
<?xml version="1.0" encoding="UTF-8"?><CDLMTESTRUNLOG xmlns="http://www.ibm.com/maximo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" rowstamp="19461239"><CDLMTESTRUNLOGNUM>9471</CDLMTESTRUNLOGNUM><CDLMTESTNUM>COMPANYMASTERUI</CDLMTESTNUM><EXECUTIONTIME>39.816</EXECUTIONTIME><RUNCOUNT>1</RUNCOUNT><FAILURECOUNT>0</FAILURECOUNT><RUNDATE>2014-04-07T12:53:45+02:00</RUNDATE><LOG><?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type='text/xsl' href='TestReport.xsl'?> <testcase> <header> <title>Test Title</title> <description>Test Description</description> <class>Test Class</class> <author>Autor</author> <date>2014-04-07 12:53:16</date> <status>PASSED</status> </header> <test name="testCompanyMasterUI"> <step number="1" action="Login into Maximo" expected="Start center displayed" actual="Start center displayed" status="PASSED" /> <step number="2" action="Open Company Master app" expected="Company Master app opened" actual="Company Master app opened" status="PASSED" /> <step number="3" action="Insert new Comp Master" expected="Company Master created" actual="Company Master created" status="PASSED" /> <step number="4" action="Set Id" expected="Company Master id set to id 368" actual="Company Master id set to testREST368" status="PASSED" /> <step number="5" action="Create Company form Company Master" expected="Company created" actual="Company created" status="PASSED" /> </test> </testcase></LOG><PARAMS>mode=remote browser=firefox remoteSelenesServerAddress=http://localhost:5555/wd/hub maximoAddress=http://localhost:3680/maximo username=maxadmin password=maxadmin slowDownLevel=0 compMasterName=testREST</PARAMS><TESTCLASS>com.example.tests.CompanyMasterUI</TESTCLASS><CDLMTESTRUNLOGID>10162</CDLMTESTRUNLOGID><HASLD>0</HASLD><LANGCODE>EN</LANGCODE></CDLMTESTRUNLOG>
Getting Test Run Failure Log
If the test you executed failed and you want to get failure log of that test run, you can do that by sending POST request to following URL:
http://maximoaddress/maxrest/rest/mbo/cdlmfailurelogwhere
maximoaddress
should be your Maximo URL (eg. localhost:9080/maximo).
HTTP header to include is:
x-http-method-override:getTestFailures
Accepted POST parameters are:
_lid
- Maximo login username (required)_lpwd
- Maximo login password (required)~testRunNum
- Test case to execute (required)
The parameter ~testRunNum
is provided in the test execution response XML as the value in the <cdlmtestrunlognum> tag.
Complete failure log retrieval example:
Content of the batch file that uses CURL library to execute POST request:
curl -d "_lid=maxadmin&_lpwd=maxadmin&~testRunNum=9471" --header "x-http-method-override:getTestFailures" http://localhost:9080/maxrest/rest/mbo/cdlmfailurelogResponse XML will contain failure records identical to those in Test Case application:
<?xml version="1.0" encoding="UTF-8"?><CDLMFAILURELOGMboSet rsStart="0" xmlns="http://www.ibm.com/maximo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><CDLMFAILURELOG xmlns="http://www.ibm.com/maximo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><CDLMFAILURELOGNUM>3700</CDLMFAILURELOGNUM><CDLMTESTRUNLOGNUM>9407</CDLMTESTRUNLOGNUM><STACKTRACE>java.lang.NullPointerException at com.example.tests.CompanyMasterUI.afterTestCase(CompanyMasterUI.java:1292) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.junit.internal.runners.ClassRoadie.runAfters(ClassRoadie.java:65) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:40) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.junit.internal.runners.CompositeRunner.runChildren(CompositeRunner.java:33) at org.junit.internal.runners.CompositeRunner.run(CompositeRunner.java:28) at org.junit.runner.JUnitCore.run(JUnitCore.java:130) at org.junit.runner.JUnitCore.run(JUnitCore.java:109) at org.junit.runner.JUnitCore.run(JUnitCore.java:100) at org.junit.runner.JUnitCore.runClasses(JUnitCore.java:60) at rs.cdl.app.maxtaf.CdlmTestRunLog.runtest(CdlmTestRunLog.java:204) at rs.cdl.app.maxtaf.CdlmTestRunLog.runtest(CdlmTestRunLog.java:143) at rs.cdl.app.maxtaf.CdlmTestRunLog.runtest(CdlmTestRunLog.java:139) at rs.cdl.maxtaf.thread.TestThread.runTest(TestThread.java:51) at rs.cdl.maxtaf.thread.TestThread.run(TestThread.java:20)</STACKTRACE><TESTHEADER>com.example.tests.CompanyMasterUI</TESTHEADER><CDLMFAILURELOGID>4483</CDLMFAILURELOGID><HASLD>0</HASLD><LANGCODE>EN</LANGCODE><FAILUREMESSAGE>Test failed at line: 1292. Failure message: null</FAILUREMESSAGE></CDLMFAILURELOG><CDLMFAILURELOG xmlns="http://www.ibm.com/maximo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><CDLMFAILURELOGNUM>3699</CDLMFAILURELOGNUM><CDLMTESTRUNLOGNUM>9407</CDLMTESTRUNLOGNUM><STACKTRACE>org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: '2.33.0', revision: '4ecaf82108b2a6cc6f006aae81961236eba93358', time: '2013-05-22 12:00:17' System info: os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1 build 7601 Service Pack 1', java.version: '1.6.0' Driver info: driver.version: RemoteWebDriver at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129) at rs.cdl.maxtaf.selenium.RemoteWebDriver.<init>(RemoteWebDriver.java:29) at rs.cdl.maxtaf.selenium.SeleniumUtil.createDriver(SeleniumUtil.java:117) at com.example.tests.CompanyMasterUI.beforeTestCase(CompanyMasterUI.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.junit.internal.runners.ClassRoadie.runBefores(ClassRoadie.java:49) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:36) at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) at org.junit.internal.runners.CompositeRunner.runChildren(CompositeRunner.java:33) at org.junit.internal.runners.CompositeRunner.run(CompositeRunner.java:28) at org.junit.runner.JUnitCore.run(JUnitCore.java:130) at org.junit.runner.JUnitCore.run(JUnitCore.java:109) at org.junit.runner.JUnitCore.run(JUnitCore.java:100) at org.junit.runner.JUnitCore.runClasses(JUnitCore.java:60) at rs.cdl.app.maxtaf.CdlmTestRunLog.runtest(CdlmTestRunLog.java:204) at rs.cdl.app.maxtaf.CdlmTestRunLog.runtest(CdlmTestRunLog.java:143) at rs.cdl.app.maxtaf.CdlmTestRunLog.runtest(CdlmTestRunLog.java:139) at rs.cdl.maxtaf.thread.TestThread.runTest(TestThread.java:51) at rs.cdl.maxtaf.thread.TestThread.run(TestThread.java:20) Caused by: org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:5555 refused at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190) at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:151) at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:125) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:316) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:295) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527) ... 24 more Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:363) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:225) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:212) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:377) at java.net.Socket.connect(Socket.java:539) at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:127) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180) ... 32 more</STACKTRACE><TESTHEADER>com.example.tests.CompanyMasterUI</TESTHEADER><CDLMFAILURELOGID>4482</CDLMFAILURELOGID><HASLD>0</HASLD><LANGCODE>EN</LANGCODE><FAILUREMESSAGE>Test failed at line: 61. Failure message: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: '2.33.0', revision: '4ecaf82108b2a6cc6f006aae81961236eba93358', time: '2013-05-22 12:00:17' System info: os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1 build 7601 Service Pack 1', java.version: '1.6.0' Driver info: driver.version: RemoteWebDriver</FAILUREMESSAGE></CDLMFAILURELOG></CDLMFAILURELOGMboSet>
Adding New Library Required By a Test
When compiling, you can use any additional library (jar or zip file) if needed.
To set an additional library file, you need to add a new property from the MaxTAF Administration application. To open this application use: Go To > MaxTAF > MaxTAF Administration
Use New Row to add a property and set the following fields:
- Property Name:lib.nnn, where nnn is the string representing sequential number of your library file, starting with '001' to '999', e.g. lib.001, lib.002, …, lib.999
- Description: description of your library file
- Value: full file name of your library, e.g. c:\maxtaftests\j2ee.jar. The full file name includes the path to the file.
- Leave other fields as defaulted by Maximo