如何在 Jspresso 中实现 Tmar 测试?
How to implement a Tmar test in Jspresso?
按照 www.tmar-test.com 安装过程,我在我的 Jspresso 应用程序中写了一个非常基本的测试(算术和),一切正常。
第二步,我想编写一个更真实的测试并调用一个属于我的 Jspresso 应用程序的方法。
我需要启动测试描述上下文才能调用该方法,但我缺少信息。
你有帮助我的片段吗?
例如,基于 Hrsample,您能否提供一个调用 computeAge 方法的 Tmar 方法?
在 computeAge 方法下面:
package org.jspresso.hrsample.model.service;
import java.util.Date;
import org.jspresso.hrsample.model.Employee;
import org.jspresso.framework.model.component.service.IComponentService;
/**
* The services delegate of the Employee entity
*/
public class EmployeeServiceDelegate implements IComponentService {
/**
* Computes the employee age.
*
* @param employee
* the employee this service execution has been triggered on.
* @param birthDate
* a birth date (might be different than the actual employee birth
* date).
* @return the age computed from the birth date passed as parameter.
*/
public Integer computeAge(Employee employee, Date birthDate) {
if (birthDate != null) {
return new Integer(
(int) ((new Date().getTime() - birthDate.getTime()) / (1000L * 60 * 60 * 24 * 365)));
}
return null;
}
}
查看 this post Jspresso.org 应该对你有帮助。
按照 www.tmar-test.com 安装过程,我在我的 Jspresso 应用程序中写了一个非常基本的测试(算术和),一切正常。
第二步,我想编写一个更真实的测试并调用一个属于我的 Jspresso 应用程序的方法。
我需要启动测试描述上下文才能调用该方法,但我缺少信息。
你有帮助我的片段吗?
例如,基于 Hrsample,您能否提供一个调用 computeAge 方法的 Tmar 方法?
在 computeAge 方法下面:
package org.jspresso.hrsample.model.service;
import java.util.Date;
import org.jspresso.hrsample.model.Employee;
import org.jspresso.framework.model.component.service.IComponentService;
/**
* The services delegate of the Employee entity
*/
public class EmployeeServiceDelegate implements IComponentService {
/**
* Computes the employee age.
*
* @param employee
* the employee this service execution has been triggered on.
* @param birthDate
* a birth date (might be different than the actual employee birth
* date).
* @return the age computed from the birth date passed as parameter.
*/
public Integer computeAge(Employee employee, Date birthDate) {
if (birthDate != null) {
return new Integer(
(int) ((new Date().getTime() - birthDate.getTime()) / (1000L * 60 * 60 * 24 * 365)));
}
return null;
}
}
查看 this post Jspresso.org 应该对你有帮助。