本文整理汇总了Java中vk.core.api.TestFailure类的典型用法代码示例。如果您正苦于以下问题:Java TestFailure类的具体用法?Java TestFailure怎么用?Java TestFailure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestFailure类属于vk.core.api包,在下文中一共展示了TestFailure类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getFailedTestMessages
import vk.core.api.TestFailure; //导入依赖的package包/类
/**
* Builds a String composed of all Test-Errors and returns them with a new
* line at the end of each error.
*
* @return The String of Test-Errors
*/
public String getFailedTestMessages() {
try {
String errors = "";
TestResult result = compiler.getTestResult();
for (TestFailure failure : result.getTestFailures()) {
errors += "Testmethode '" + failure.getMethodName() + "' ist fehlgeschlagen: " + failure.getMessage()
+ "\n";
}
// String empty = All tests happy
if (errors.equals("")) {
return "Keine fehlschlagenden Tests!\n";
}
return errors;
} catch (Exception e) {
return "";
}
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-nosuchfieldexception,代码行数:24,代码来源:KataLiveCompiler.java
示例2: handleTests
import vk.core.api.TestFailure; //导入依赖的package包/类
private String handleTests(JavaStringCompiler myCompileObject) {
String testResults = "";
TestResult happyEndChecker = myCompileObject.getTestResult();
if(happyEndChecker.getNumberOfFailedTests() == 0) {
testResults += "All tests succeeded!\n";
testSuccess = true;
}
else {
testSuccess = false;
testResults += "Successful Tests: " + happyEndChecker.getNumberOfSuccessfulTests() + "\n";
testResults += "Failed Tests: " + happyEndChecker.getNumberOfFailedTests() + "\n\n";
Collection<TestFailure> fails = happyEndChecker.getTestFailures();
Iterator<TestFailure> fail = fails.iterator();
while(fail.hasNext()) {
TestFailure found = fail.next();
testResults += "Class: " + found.getTestClassName() + "\n"
+ "Method: " + found.getMethodName() + "\n"
+ "Message: " + found.getMessage();
}
}
return testResults;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-stack-overflow,代码行数:23,代码来源:CompileHandler.java
示例3: handleAcceptanceTests
import vk.core.api.TestFailure; //导入依赖的package包/类
private String handleAcceptanceTests(JavaStringCompiler myCompileObject) {
String testResults = "";
TestResult happyEndChecker = myCompileObject.getTestResult();
if(happyEndChecker.getNumberOfFailedTests() == 0) {
testResults += "All tests succeeded!";
acceptance = true;
}
else {
acceptance = false;
testResults += "Acceptance Test Failed\n";
testResults += "Successful Tests: " + happyEndChecker.getNumberOfSuccessfulTests() + "\n";
testResults += "Failed Tests: " + happyEndChecker.getNumberOfFailedTests() + "\n\n";
Collection<TestFailure> fails = happyEndChecker.getTestFailures();
Iterator<TestFailure> fail = fails.iterator();
while(fail.hasNext()) {
TestFailure found = fail.next();
testResults += "Class: " + found.getTestClassName() + "\n"
+ "Method: " + found.getMethodName() + "\n"
+ "Message: " + found.getMessage();
}
}
return testResults;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-stack-overflow,代码行数:25,代码来源:CompileHandler.java
示例4: test
import vk.core.api.TestFailure; //导入依赖的package包/类
/**
* Gibt Testergebnisse auf die (programminterne) Konsole aus.
*
* Wandelt übergebene Compilationunits mit {@link #getJSC(CompilationUnit[])} in JavaStringCompiler um,
* bestimmt Anzahl der erfolgreichen und fehlgeschlagenen Tests und gibt dies, sowie genauere Fehlermendungen
* auf der programminternen Konsole aus.
*/
public static void test(CompilationUnit[] comp_uns){ //gibt testergebnisse auf console aus
JavaStringCompiler comp = getJSC(comp_uns);
TestResult test_res = comp.getTestResult();
int tests_ok = test_res.getNumberOfSuccessfulTests();
int tests_fail = test_res.getNumberOfFailedTests();
console.set_textln("Testresult:");
Collection<TestFailure> fails = test_res.getTestFailures();
console.set_textln("OK: "+tests_ok+" FAIL: "+tests_fail);
for(TestFailure fail: fails){
console.set_textln("Testname: "+fail.getTestClassName());
console.set_textln("Methodname: "+fail.getMethodName());
console.set_textln(fail.getMessage());
console.set_textln("");
}
console.set_textln("");
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-1,代码行数:25,代码来源:Testing.java
示例5: getFailingTests
import vk.core.api.TestFailure; //导入依赖的package包/类
public String[] getFailingTests(){
if(aktuell.getTestUnit() == null || aktuell.getCodeUnit() == null)
return new String[0];
InternalCompiler compileTest = new InternalCompiler(new CompilationUnit[] {aktuell.getTestUnit(), aktuell.getCodeUnit()});
compileTest.compileAndRunTests();
Object[] failObjects = compileTest.getTestResult().getTestFailures().toArray();
String[] rueckgabe = new String[failObjects.length];
for(int i = 0; i < rueckgabe.length; i++) {
rueckgabe[i] = ((TestFailure) failObjects[i]).getMessage();
if(rueckgabe[i] == null) {
rueckgabe[i] = ((TestFailure)failObjects[i]).getMethodName();
}
}
return rueckgabe;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-amigos,代码行数:20,代码来源:LogikHandler.java
示例6: BadTest
import vk.core.api.TestFailure; //导入依赖的package包/类
public void BadTest() {
Collection<TestFailure> failures=Tests.getTestFailures();
if (failures==null) {SeriousError=true; return;}
for (TestFailure F:failures) {
Error=F.getMessage();
}
if (Error.equals("No runnable methods")) {
Error = "Du hast keine Tests implementiert !\n" +
"Falls schon, dann denke bitte an das @Test !\n";
ready=false;
wroteTests=false;
}
else {
wroteTests=true;
}
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-halt-doch-einfach-mal-dein-maul,代码行数:17,代码来源:GreenValidator.java
示例7: runTests
import vk.core.api.TestFailure; //导入依赖的package包/类
public static void runTests(String code,String codeClassName, String tests, String testClassName){
compile(code ,codeClassName , tests, testClassName);
if(compilerResult.hasCompileErrors())
return;
failedTests=0;
CompilationUnit[] cus = {test , program};
InternalCompiler compiler = new InternalCompiler(cus);
compiler.compileAndRunTests();
TestResult testResult = compiler.getTestResult();
if(testResult != null)
failedTests = testResult.getNumberOfFailedTests();
if(failedTests > 0){
Collection<TestFailure> testFailures = testResult.getTestFailures();
TestFailure[] failureArray = new TestFailure[testFailures.size()];
failureArray = testFailures.toArray(failureArray);
for(int i=0; i<failureArray.length;i++){
Test_UI.compileOutput.setText(Test_UI.compileOutput.getText()+" \n"+ failureArray[i].getMethodName());
Test_UI.compileOutput.setText(Test_UI.compileOutput.getText()+" \n"+ failureArray[i].getMessage());
System.out.println(failureArray[i].getMethodName());
System.out.println(failureArray[i].getMessage());
}
}
if(failedTests == 1 && Test_UI.status.equals("writeTest"))
Test_UI.switchStatus(true);
if(failedTests == 0 && Test_UI.status.equals("fixTest"))
Test_UI.switchStatus(true);
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-proprawunderbar,代码行数:28,代码来源:Compile.java
示例8: formatFailingTests
import vk.core.api.TestFailure; //导入依赖的package包/类
/**
* @see #formatCompileErrors(CompilerResult, CompilationUnit)
* @param tr The testresult of the failed test.
* @return A String that contains all the errors.
*/
private String formatFailingTests(TestResult tr) {
StringBuilder output = new StringBuilder();
Collection<TestFailure> failureList = tr.getTestFailures();
for (TestFailure failure : failureList) {
output.append(failure.getMethodName());
output.append(": ");
output.append(failure.getMessage());
output.append("\n");
}
return output.toString();
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-nimmdochirgendeinennamen,代码行数:17,代码来源:TDDTCompiler.java
示例9: failedTests
import vk.core.api.TestFailure; //导入依赖的package包/类
public void failedTests(TestResult Result) {
Tracker.addEvent("Nicht bestandene Tests");
String Message="";
Collection<TestFailure> failures=Result.getTestFailures();
for (TestFailure F:failures) {
Message+="Fehler bei:\n"+F.getMethodName()+"\n";
Message+=F.getMessage()+"\n";
}
Action.setHeaderText("Tests schlagen fehl !");
Action.setContentText("Nicht alle Tests sind erfolgreich ! \n" + Message + "\n" +
"Bitte sorge daf" + "\u00FC" + "r, dass alle Tests laufen");
Action.showAndWait();
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-halt-doch-einfach-mal-dein-maul,代码行数:14,代码来源:WarningUnit.java
示例10: ErrorEvent
import vk.core.api.TestFailure; //导入依赖的package包/类
public ErrorEvent(List<TestFailure> errors){
this.errors = errors;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-1,代码行数:4,代码来源:ErrorEvent.java
示例11: getErrors
import vk.core.api.TestFailure; //导入依赖的package包/类
public List<TestFailure> getErrors(){
return errors;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-1,代码行数:4,代码来源:ErrorEvent.java
示例12: TestFailureItem
import vk.core.api.TestFailure; //导入依赖的package包/类
/**
* Constructs a test failure item
*
* @param testFailure
*/
public TestFailureItem(TestFailure testFailure) {
super(testFailure.getMethodName(), testFailure.getMessage());
getStyleClass().add("test-failure-item");
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-null,代码行数:10,代码来源:TestFailureItem.java
注:本文中的vk.core.api.TestFailure类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论