Adding checks to Teststyle [message #1263391] |
Tue, 04 March 2014 07:45  |
Eclipse User |
|
|
|
Hi,
i'm writing a plugin for Jubula and i'm wondering if there is a way to add my own checks to Teststyle? I found the appropriate library (org/eclipse/jubula/client/teststyle), but it seems that most of the classes in this library are not accessable. There are only a few classes in the build path which are allowed by the access rules, but even if i change the access rules, i get ClassNotFoundExceptions...
Hope anyone can help me
Daniel
|
|
|
|
|
|
Re: Adding checks to Teststyle [message #1265823 is a reply to message #1263391] |
Thu, 06 March 2014 11:03   |
Eclipse User |
|
|
|
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 04:14  |
Eclipse User |
|
|
|
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.03938 seconds