This repository has been archived by the owner on Mar 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/headissue/Sahi
- Loading branch information
Showing
21 changed files
with
200 additions
and
146 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
language: java | ||
jdk: | ||
- oraclejdk8 | ||
- oraclejdk7 | ||
- openjdk7 |
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
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
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
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
Empty file.
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
100 changes: 100 additions & 0 deletions
100
sahi-core/src/main/java/net/sf/sahi/report/ConsoleFormatter.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package net.sf.sahi.report; | ||
|
||
import java.text.DateFormat; | ||
import java.util.List; | ||
|
||
public class ConsoleFormatter implements Formatter { | ||
|
||
public String getFileName(String scriptName) { | ||
return ""; | ||
} | ||
|
||
public String getHeader() { | ||
return ""; | ||
} | ||
|
||
public String getResultData(List<TestResult> listResult) { | ||
StringBuffer sb = new StringBuffer(); | ||
if (listResult != null && listResult.size() > 0) { | ||
for (int i = 0; i < listResult.size(); i++) { | ||
TestResult result = listResult.get(i); | ||
String res = getStringResult(result); | ||
if (!res.isEmpty()) { | ||
sb.append(res).append("\n"); | ||
} | ||
} | ||
} | ||
|
||
return sb.toString(); | ||
} | ||
|
||
public String getStringResult(final TestResult result) { | ||
if (result.type.equals(ResultType.RAW)) { | ||
return result.message; | ||
} | ||
if (!(ResultType.FAILURE.equals(result.type) || ResultType.ERROR.equals(result.type))) { | ||
return ""; | ||
} | ||
|
||
StringBuffer sb = new StringBuffer(); | ||
sb.append("[").append(result.type.getName()).append( | ||
"] "); | ||
if (result.debugInfo != null) { | ||
sb.append(result.debugInfo); | ||
} | ||
sb.append("\t").append(DateFormat.getDateTimeInstance().format(result.time)); | ||
if (result.message != null && !result.message.isEmpty()) { | ||
sb.append("\n\t").append(result.message.trim().replace("\n", "\n\t")); | ||
} | ||
if (result.failureMsg != null && !result.failureMsg.isEmpty()) { | ||
sb.append("\n\t").append(result.failureMsg.trim().replace("\n", "\n\t")); | ||
} | ||
return sb.toString(); | ||
} | ||
|
||
public String getSummaryHeader() { | ||
return ""; | ||
} | ||
|
||
public String getSummaryData(TestSummary summary) { | ||
StringBuffer sb = new StringBuffer(); | ||
int successRate = summary.getSteps() != 0 ? ((summary.getSteps() - (summary.getFailures() + summary.getErrors())) * 100) / summary.getSteps() | ||
: 100; | ||
sb.append("[") | ||
.append(summary.hasFailed() ? ResultType.FAILURE.getName() : ResultType.SUCCESS.getName()) | ||
.append("] ") | ||
.append(summary.getScriptName()) | ||
.append("\nSahi Tests run: ").append(summary.getSteps()) | ||
.append(", Failures: ").append(summary.getFailures()) | ||
.append(", Errors: ").append(summary.getErrors()) | ||
/* | ||
.append(" -> Rate: ").append(successRate) | ||
.append("%") | ||
*/ | ||
.append(", Time Elapsed: ") | ||
.append(new Double(summary.getTimeTaken()) / 1000) | ||
.append(" sec") | ||
.append("\n"); | ||
return sb.toString(); | ||
} | ||
|
||
public String getSummaryFooter() { | ||
return ""; | ||
} | ||
|
||
public String getStartScript() { | ||
return ""; | ||
} | ||
|
||
public String getStopScript() { | ||
return ""; | ||
} | ||
|
||
public String getFooter() { | ||
return ""; | ||
} | ||
|
||
public String getSuiteLogFileName() { | ||
return ""; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
sahi-core/src/main/java/net/sf/sahi/report/ConsoleReporter.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package net.sf.sahi.report; | ||
|
||
import net.sf.sahi.test.TestLauncher; | ||
|
||
import java.io.*; | ||
import java.util.List; | ||
|
||
public class ConsoleReporter extends SahiReporter { | ||
|
||
BufferedWriter outWriter = new BufferedWriter(new OutputStreamWriter(System.out)) { | ||
@Override | ||
public void close() throws IOException { | ||
// we won't close System.out | ||
} | ||
}; | ||
|
||
public ConsoleReporter() { | ||
super(new ConsoleFormatter()); | ||
} | ||
|
||
@Override | ||
public boolean createSuiteLogFolder() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void generateSuiteReport(List<TestLauncher> tests) { | ||
// disabled | ||
} | ||
|
||
@Override | ||
protected Writer createWriter(String file) throws IOException { | ||
return outWriter; | ||
} | ||
} |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
## Integration Tests | ||
|
||
This package is meant to provide a set of sample .html files and test suites to make sure the API works. | ||
This package is meant to provide a set of sample .html files and test suites to make sure the Sahi API works. | ||
|
||
Just run the TestApiItegration unittest. | ||
Just run the TestApiIntegration unit test. | ||
|
||
|
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
Oops, something went wrong.