Last active
December 15, 2015 04:50
-
-
Save AdamSaleh/5204230 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Myslim ze najjednoduchsie bude, ak si stiahnes tento projekt: | |
https://github.com/AdamSaleh/TestParser | |
a reimplementujes class Parser. V podstate ju nikde neposielam okrem tych troch riadkov, | |
https://github.com/AdamSaleh/NitrateRPC/blob/master/src/main/java/NitrateIntegration/TcmsPublisher.java | |
(riadky 137,144,150) | |
tzn lubovolna class ktora zvladne naloadovat xml a vratit class test-results viem zintegrovat. | |
Tymto stylom mozes pouzit uz napisany TestResults, TestResult, MethodResult, e.t.c bez toho aby si ich musel extendovat. | |
TestResults interface je implementovany v MatrixRunTestResults | |
Nakrmis ich takto: | |
import java.util.UUID | |
TestResults createresults(){ | |
TestResults finalResults = new MatrixRunTestResults(UUID.randomUUID().toString()); | |
List<TestResult> testList = new ArrayList<TestResult>(); | |
currentTest = new TestResult(name); | |
currentClassList = new ArrayList<ClassResult>(); | |
currentClass = new ClassResult(name); | |
currentMethodList = new ArrayList<MethodResult>(); | |
//reset for each class | |
currentTestRunId = UUID.randomUUID().toString(); | |
MethodResult currentMethod = new MethodResult(name, status, description, duration, | |
startedAtDate, isConfig, currentTestRunId, currentTest.getName(), | |
currentSuite, testInstanceName); | |
currentMethodParamsList = new ArrayList<String>(); | |
currentMethod.setParameters(currentMethodParamsList); | |
MethodResultException mrEx = new MethodResultException(currentMessage, | |
currentShortStackTrace, currentFullStackTrace); | |
currentMethod.setException(mrEx); | |
updateTestMethodLists(currentMethod); // tu sa triedia metody na passed/failed/skipped | |
currentMethodList.add(currentMethod); | |
currentClass.addTestMethods(currentMethodList); | |
currentClassList.add(currentClass); | |
currentTest.addClassList(currentClassList); | |
testList.add(currentTest); | |
finalResults.addUniqueTests(testList); | |
finalResults.tally(); | |
} | |
MethodResult je v jednoducha trieda v ktorej drzim hodnotu testu | |
String name, | |
String status, -> tu ukladas cez string "PASS" "FAIL" "SKIP" | |
String description, | |
String duration, | |
Date startedAt, | |
String isConfig, | |
String testRunId, | |
String parentTestName, | |
String parentSuiteName, | |
String testInstanceName | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment