protected static String getMethodName(ITestResult tr) { String method_name = tr.getName(); Object[] params = tr.getParameters(); if (params != null && params.length > 0) { String tmp = null; if (params[0] instanceof Class<?>) tmp = ((Class<?>) params[0]).getSimpleName(); else if (params[0] != null) tmp = params[0].getClass().getSimpleName(); if (tmp != null) method_name = method_name + "-" + tmp; } return method_name; }
// returns an ID for each test result private int getTestId(ITestResult result) { int id = result.getTestClass().getName().hashCode(); id = 31 * id + result.getMethod().getMethodName().hashCode(); id = 31 * id + (result.getParameters() != null ? Arrays.hashCode(result.getParameters()) : 0); return id; }