WDK ATF - "Negative" testing
Best Answer
-
Hi Saul,
For WDK actions, the ATF automatically inserts validation code blocks into the test case class for the step which initiates the action. If you're expecting the action to fail, you can remove this validation code.
An example test step might look like:
=====================================================================
public class Step0_ExecuteNewcabinetAction extends ComponentTestStep implements IActionListener, IActionCompleteListener
{
public boolean isApplicable(Component component)
{
return ComponentHelper.getComponent(component, "actiondispatcher") != null;
}public ClientEvent[] getClientEvents(Component component)
{
return NoOpClientEvent.getEvents();
}public void onPreAction(String strActionId, ArgumentList args, Context context, Form form)
{
if (m_actionValidator == null)
{
m_actionValidator = ActionValidatorInstantiator.instantiateValidator(strActionId);
}if (m_actionValidator != null)
{
m_actionValidator.saveInitialState(strActionId, args, context, form);
}
}public void onPostAction(String strActionId, ArgumentList args, Context context, Form form)
{
}public void onComplete(String strAction, boolean bSuccess, Map completionArgs)
{
if (m_actionValidator != null)
{
m_actionValidator.validateAction(strAction, bSuccess, completionArgs);
}// todo: if applicable, add your onComplete (due to 'newcabinet' action) verification logic here
}
private ITestStepActionValidator m_actionValidator = null;
}=====================================================================
The code in red which calls the validateAction method can be removed which should allow for the test with an error scenario.
Linda
0
Answers
-
Hi Saul,
For WDK actions, the ATF automatically inserts validation code blocks into the test case class for the step which initiates the action. If you're expecting the action to fail, you can remove this validation code.
An example test step might look like:
=====================================================================
public class Step0_ExecuteNewcabinetAction extends ComponentTestStep implements IActionListener, IActionCompleteListener
{
public boolean isApplicable(Component component)
{
return ComponentHelper.getComponent(component, "actiondispatcher") != null;
}public ClientEvent[] getClientEvents(Component component)
{
return NoOpClientEvent.getEvents();
}public void onPreAction(String strActionId, ArgumentList args, Context context, Form form)
{
if (m_actionValidator == null)
{
m_actionValidator = ActionValidatorInstantiator.instantiateValidator(strActionId);
}if (m_actionValidator != null)
{
m_actionValidator.saveInitialState(strActionId, args, context, form);
}
}public void onPostAction(String strActionId, ArgumentList args, Context context, Form form)
{
}public void onComplete(String strAction, boolean bSuccess, Map completionArgs)
{
if (m_actionValidator != null)
{
m_actionValidator.validateAction(strAction, bSuccess, completionArgs);
}// todo: if applicable, add your onComplete (due to 'newcabinet' action) verification logic here
}
private ITestStepActionValidator m_actionValidator = null;
}=====================================================================
The code in red which calls the validateAction method can be removed which should allow for the test with an error scenario.
Linda
0
Categories
- All Categories
- 107 Developer Announcements
- 53 Articles
- 105 General Questions
- 141 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 898 Cloud Fax and Notifications
- 76 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 118 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management