我的任务是确定我的@Entity
@EntityListeners(com.acme.AlertMonitor.class) // set callback method in another class
public class Account {
Long accountId;
Integer balance;
boolean preferred;
@Id
public Long getAccountId() { ... }
...
public Integer getBalance() { ... }
...
@Transient
public boolean isPreferred() { ... }
...
public void deposit(Integer amount) { ... }
public Integer withdraw(Integer amount) throws NSFException {... }
@PreUpdate // callback method in some class
protected void validateCreate() {
if (getBalance() < MIN_REQUIRED_BALANCE)
throw new AccountException("Insufficient balance to open an
account");
}
@PostUpdate // callback method in some class
protected void adjustPreferredStatus() {
preferred =
(getBalance() >= AccountManager.getPreferredStatusLevel());
}
}
// callback method in another class
public class AlertMonitor {
@PreUpdate // callback method in another class
public void updateAccountAlert(Account acct) {
Alerts.sendMarketingInfo(acct.getAccountId(), acct.getBalance());
}
}
脚本套件的覆盖范围。基本上,我的自动脚本运行的代码百分比是多少?
是否有任何可以部署的工具可以突出显示在自动脚本运行时访问的代码片段?
我还可以使用结果来评估自动化套件中的差距。
答案 0 :(得分:2)
查看JaCoCo,特别是Session Import and Export部分。 JaCoCo是一个Eclipse插件。它的主要用例是在IDE中设置代码并显示覆盖范围,这将突出显示已访问的代码片段。您可以检测代码,运行自动化套件,然后将执行数据导入Eclipse,以使用上面提到的会话导入查看执行的代码。