|
Re: Adding checks to Teststyle [message #1263516 is a reply to message #1263391] |
Tue, 04 March 2014 14:56 |
|
Hi,
the org.eclipse.jubula.client.teststyle bundle contains just the infrastructure necessary to run the checks. For an example on how to implement checks have a look at the org.eclipse.jubula.client.teststyle.impl.standard bundle.
The classes exported from org.eclipse.jubula.client.teststyle are the base clases from which you might sub-class your checks. Please don't change any access rules because this limitations are there for a reason (i.e. to hide non-API classes).
- Achim
|
|
|
|
Re: Adding checks to Teststyle [message #1265637 is a reply to message #1264836] |
Thu, 06 March 2014 10:45 |
|
Hi Daniel,
tried to contact you by phone but failed
You don't need to run a check. This is done by the framework once you have added the check and marked it as "runnable" in the properties page. If you are in the IDE you can check this by setting a breakpoint in your check.
HTH
Achim
|
|
|
Re: Adding checks to Teststyle [message #1265823 is a reply to message #1263391] |
Thu, 06 March 2014 16:03 |
Daniel Hör Messages: 7 Registered: February 2014 Location: Augsburg, Germany |
Junior Member |
|
|
Hi Achim,
The framework doesn't run my check. But apart from that, i have some other problems creating the check:
1. How can i create a new Category? I didn't find the right method, so for testing i used an existing Category
Category tcCat = CheckCont.getCategories().iterator().next();
2. Am i right in assuming that the BaseContext of a check represents the class of the objects that should be checked?
So, since the BaseContext class is not accessable, the only way i found to set the context was to create an ICheckConfPO object:
IProjectPO project = GeneralStorage.getInstance().getProject();
ICheckConfContPO chkConfCont = project.getProjectProperties().getCheckConfCont();
ICheckConfPO chkConf = chkConfCont.createCheckConf();
Map<String, Boolean> contextMap = new HashMap<String, Boolean>();
contextMap.put("TestSuiteContext", true);
chkConf.setContexts(contextMap);
chkConf.setActive(true);
Actually i want Test Cases to be checked, but it seems that "TestSuiteContext" is the only key that is accepted. I tried it with ExecTestCaseContext and SpecTestCaseContext but i got a NullPointerException.
3. I'm not sure if i forgot something to implement the check:
TestCaseNamesCorrect tcCheck = new TestCaseNamesCorrect();
tcCheck.setName("TestCases must have specified names");
tcCheck.setFulltextDescription("TestCase names must match the pattern 'Txxxxxx'");
tcCheck.setId("jubulatestplugin.TestCaseNamesCorrect");
tcCheck.setConf(chkConf);
tcCat.addCheck(tcCheck);
public class TestCaseNamesCorrect extends BaseCheck {
@Override
public String getDescription() {
return "TestCases must have specified names";
}
@Override
public boolean hasError(Object obj) {
if (obj instanceof ITestCasePO)
{
ITestCasePO tc = (ITestCasePO) obj;
if (!Pattern.matches("T\\d{6}", tc.getName()))
return true;
}
return false;
}
}
Thanks for your help, i'm sorry you could'nt contact me, maybe next time
Daniel
|
|
|
|
|
|
Re: Adding checks to Teststyle [message #1291794 is a reply to message #1289715] |
Fri, 11 April 2014 08:14 |
|
Test results are stored separately in the database. There are no direct dependencies modeled for those. To get test results for a specific run you have to load the result and maintain their life cycle yourself. The code for displaying the test results overview and the subsequent actions when opening an editor to display them will give you a good overview of this tasks.
There is, however, a catch. Test style actions are run at the discretion of the Teststyle framework. There is no life cycle support there. It would be difficult to ensure that the results are loaded at the appropriate time and it would be next to impossible to get rid of them (from memory) once they are no longer needed.
- Achim
|
|
|
Powered by
FUDForum. Page generated in 0.04234 seconds