/** * Faz a comunicação com o Testlink para reportar os resultados * @author Elias Nogueira <[email removido]> */publicclassResultadoExecucaoimplementsIConstantes{/** * Método para reportar o resultado do teste automatizado para o Testlink * @see http://code.google.com/p/dbfacade-testlink-rpc-api/wiki/Documentation * @param projetoTeste nome do Projeto de Teste * @param planoTeste nome do Plano de Teste * @param casoTeste nome do Caso de Teste * @param nomeBuild nome da Build de Teste * @param nota nota que será adicionada * @param resultado resultado do teste executado * @throws TestLinkAPIException erro de comunicação na submissão dos resultados */publicstaticvoidreportTestCaseResult(StringprojetoTeste,StringplanoTeste,StringcasoTeste,StringnomeBuild,Stringnota,Stringresultado)throwsTestLinkAPIException{// Cria uma instância do TestLinkAPIClient para comunicação com o TestlinkTestLinkAPIClienttestlinkAPIClient=newTestLinkAPIClient(DEVKEY,URL);// Submete os resultados para o TestlinktestlinkAPIClient.reportTestCaseResult(projetoTeste,planoTeste,casoTeste,nomeBuild,nota,resultado);}
Já cheguei a fazer sim. O TestLink tem uma interface XMLRPC que funciona razoavelmente bem. O único problema que tive foi com relação a uma questão de encoding. Pelo que me lembro havia um bug no processamento da mensagem e se a mensagem tivesse caracteres acentuados um erro era gerado.
A
andredecotia
Estou fazendo o seguinte teste com base na interface que você comentou... Sabe me dizer o que é o DEV_KEY? A mensagem de erro caso o TC falhe é persistida em algum lugar do TestLink?
packageteste;importjava.net.MalformedURLException;importjava.net.URL;importjava.util.ArrayList;importjava.util.Date;importjava.util.Hashtable;importjava.util.Map;importorg.apache.xmlrpc.XmlRpcException;importorg.apache.xmlrpc.client.XmlRpcClient;importorg.apache.xmlrpc.client.XmlRpcClientConfigImpl;publicclassTestlinkAPIXMLRPCClient{// Substitute your Dev Key HerepublicstaticfinalStringDEV_KEY="xxxxxxxx";// Substitute your Server URL HerepublicstaticfinalStringSERVER_URL="http://10.50.18.188/lib/api/xmlrpc.php";/** * report test execution to TestLink API * * @param int tcid * @param int tpid * @param String * status */@SuppressWarnings("rawtypes")publicstaticvoidtestLinkReport(inttcid,Stringstatus){try{XmlRpcClientrpcClient;XmlRpcClientConfigImplconfig;config=newXmlRpcClientConfigImpl();config.setServerURL(newURL(SERVER_URL));rpcClient=newXmlRpcClient();rpcClient.setConfig(config);// ////////////////////////// Get available projects.// ////////////////////////ArrayList<Object>params=newArrayList<Object>();Hashtable<String,Object>executionData=newHashtable<String,Object>();executionData.put("devKey",DEV_KEY);params.add(executionData);Object[]result=(Object[])rpcClient.execute("tl.getProjects",params);intidProject=-1;// Typically you'd want to validate the result here and probably do// something more useful with itSystem.out.println("Result was:\n");for(inti=0;i<result.length;i++){Mapitem=(Map)result[i];System.out.println("Keys: "+item.keySet().toString()+" values: "+item.values().toString());if(item.get("name").equals("xxxx")){idProject=Integer.parseInt((String)item.get("id"));}}if(idProject==-1)return;// ///////////////////////////////////////////// Get available test plans in xxx project.// DOES ONLY WORK WHEN ALL TEST PLAN NAMES DO// NOT CONTAIN ANY SPECIAL CHARS LIKE UMLAUTS// ///////////////////////////////////////////params=newArrayList<Object>();executionData=newHashtable<String,Object>();executionData.put("devKey",DEV_KEY);executionData.put("testprojectid",idProject);params.add(executionData);result=(Object[])rpcClient.execute("tl.getProjectTestPlans",params);intidTestPlan=-1;// Typically you'd want to validate the result here and probably do// something more useful with itSystem.out.println("Result was:\n");for(inti=0;i<result.length;i++){Mapitem=(Map)result[i];System.out.println("Keys: "+item.keySet().toString()+" values: "+item.values().toString());for(Objectkey:item.keySet()){Objectelement=item.get(key);if(elementinstanceofMap==false)continue;if(((Map)element).get("name").equals("Szenario")){idTestPlan=Integer.parseInt((String)((Map)element).get("id"));}}}if(idTestPlan==-1)return;// //////////////////// Create new build.// //////////////////params=newArrayList<Object>();executionData=newHashtable<String,Object>();executionData.put("devKey",DEV_KEY);executionData.put("testplanid",idTestPlan);executionData.put("buildname","Automatischer Test am "+(newDate()).toString());executionData.put("buildnotes","Notizen...");params.add(executionData);result=(Object[])rpcClient.execute("tl.createBuild",params);intidBuild=-1;// Typically you'd want to validate the result here and probably do// something more useful with itSystem.out.println("Result was:\n");for(inti=0;i<result.length;i++){Mapitem=(Map)result[i];System.out.println("Keys: "+item.keySet().toString()+" values: "+item.values().toString());if(((Boolean)item.get("status"))==true){idBuild=Integer.parseInt((String)item.get("id"));}}if(idBuild==-1)return;// Report test case result in new build.params=newArrayList<Object>();executionData=newHashtable<String,Object>();executionData.put("devKey",DEV_KEY);executionData.put("testcaseid",tcid);executionData.put("testplanid",idTestPlan);executionData.put("buildid",idBuild);executionData.put("status",status);executionData.put("notes","testtest");params.add(executionData);result=(Object[])rpcClient.execute("tl.reportTCResult",params);// Typically you'd want to validate the result here and probably do// something more useful with itSystem.out.println("Result was:\n");for(inti=0;i<result.length;i++){Mapitem=(Map)result[i];System.out.println("Keys: "+item.keySet().toString()+" values: "+item.values().toString());}}catch(MalformedURLExceptione){e.printStackTrace();}catch(XmlRpcExceptione){e.printStackTrace();}}publicstaticvoidmain(String[]args){// Substitute this for a valid tcid and tpid within your projectTestlinkAPIXMLRPCClient.testLinkReport(4,"b");}}
P
psevestre
Se não me engano é o conteúdo de uma coluna da tabela de usuários na base do TestLink.
A
andredecotia
?
P
psevestre
Capítulo 8 do manual:
8.1 User account settings
Every guest can create own account on login page.
The auto-create feature can be disabled by configuration. There is also configurable
default role parameter (‘guest’ by default).
Every user on the system will be able to edit their own information via the Account settings
window (‘Personal’ link in menu bar). He can modify own Name, email address, password and
generate API key (if enabled).
TestLink allows users with administrator rights to create, edit, and delete users within the
system. However, TestLink does not allow administrators to view or edit user’s passwords. If
users forget their passwords there is link on the login screen, that will mail the user their
password based upon their user name and the email address they entered
Imaginemos um cenário ao qual utliza-se o Hudson, foi programado para que o teste seja executado de 30 em 30 dias… Neste caso não tem id do usuário…
abs,
A
andredecotia
Por gentileza qual API vc utilizou pra fazer a integração do Testlink com o Selenium?
A
andredecotia
Alguém pode ajudar?
A
andredecotia
A melhor e mais fácil maneira de se fazer isso, é simplesmente persistindo na tabela executions da base de dados do Testlink, os valores necessários para alimentar seu INSERT o testador pode conseguir manualmente na própria tela do Testlink mapeando através de levar a seta do mouse sobre os links e ver na barra de status o id correlacionado.
abs,
AS.
A
andredecotia
Para quem estiver passando por esta dificuldade, conseguí integrar também através da Testlink Java API encontrada no link http://testlinkjavaapi.sourceforge.net/.
A
andredecotia
A API do proprio Testlink 1.9.0 vem se compartando com demasiada intermitencia de funcionamento… Alguém já integrou de forma diferente?