-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Huge commit. Adds better support for multiple versions and differing …
…platforms/runtimes. Adds support for xUnit 2.1
- Loading branch information
Showing
40 changed files
with
1,554 additions
and
31 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# xUnit TeamCity plugin | ||
A xUnit runner for TeamCity. Supports tests written with xUnit 1.9.2 and 2.0.0, also supports wildcard include and exclude patterns. | ||
A xUnit runner for TeamCity. Supports tests written with xUnit 1.9.2, 2.0.0 and 2.1.0, also supports wildcard include and exclude patterns. | ||
|
||
# Download | ||
Latest release is 1.0, get it here: https://github.com/carlpett/xUnit-TeamCity/releases/tag/1.0. Tested and developed on TeamCity 9.0, but should probably work on 8.0 as well. |
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
19 changes: 19 additions & 0 deletions
19
xunit-common/src/main/java/se/capeit/dev/xunittestrunner/RunnerVersion.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,19 @@ | ||
package se.capeit.dev.xunittestrunner; | ||
|
||
public abstract class RunnerVersion { | ||
public final String version; | ||
public String[] supportedRuntimes; | ||
public String[] supportedPlatforms; | ||
|
||
public RunnerVersion(String version, String[] supportedRuntimes, String[] supportedPlatforms) { | ||
this.version = version; | ||
this.supportedRuntimes = supportedRuntimes; | ||
this.supportedPlatforms = supportedPlatforms; | ||
} | ||
|
||
public abstract String getRunnerPath(String runtime, String platform); | ||
|
||
public String[] getSupportedRuntimes() { return supportedRuntimes; } | ||
public String[] getSupportedPlatforms() { return supportedPlatforms; } | ||
} | ||
|
87 changes: 87 additions & 0 deletions
87
xunit-common/src/main/java/se/capeit/dev/xunittestrunner/Runners.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,87 @@ | ||
package se.capeit.dev.xunittestrunner; | ||
|
||
import java.util.*; | ||
|
||
public final class Runners { | ||
private static final TreeMap<String, RunnerVersion> AvailableRunners = new TreeMap<String, RunnerVersion>(); | ||
|
||
public TreeMap<String, RunnerVersion> getAllRunners() { return AvailableRunners; } | ||
public Set<String> getSupportedVersions() { return AvailableRunners.descendingKeySet(); } | ||
public Set<String> getSupportedRuntimes() { | ||
HashSet<String> runtimes = new HashSet<String>(); | ||
for(Map.Entry<String, RunnerVersion> runner : AvailableRunners.entrySet()) { | ||
for(String runtime : runner.getValue().supportedRuntimes) | ||
runtimes.add(runtime); | ||
} | ||
return runtimes; | ||
} | ||
public Set<String> getSupportedPlatforms() { | ||
HashSet<String> platforms = new HashSet<String>(); | ||
for(Map.Entry<String, RunnerVersion> runner : AvailableRunners.entrySet()) { | ||
for(String platform : runner.getValue().supportedPlatforms) | ||
platforms.add(platform); | ||
} | ||
return platforms; | ||
} | ||
|
||
public static RunnerVersion getRunner(String version) { | ||
return AvailableRunners.get(version); | ||
} | ||
|
||
static { | ||
AvailableRunners.put("1.9.2", new RunnerVersion("1.9.2", | ||
new String[]{Runtime.dotNET35, Runtime.dotNET40}, | ||
new String[]{Platforms.x86, Platforms.MSIL}) { | ||
@Override | ||
public String getRunnerPath(String runtime, String platform) { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("xunit.console"); | ||
if (runtime.equals(Runtime.dotNET40)) | ||
sb.append(".clr4"); | ||
if (platform.equals(Platforms.x86)) | ||
sb.append(".x86"); | ||
sb.append(".exe"); | ||
return sb.toString(); | ||
} | ||
}); | ||
|
||
AvailableRunners.put("2.0.0", new RunnerVersion("2.0.0", | ||
new String[]{Runtime.dotNET45}, | ||
new String[]{Platforms.x86, Platforms.MSIL}) { | ||
@Override | ||
public String getRunnerPath(String runtime, String platform) { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("xunit.console"); | ||
if (platform.equals(Platforms.x86)) | ||
sb.append(".x86"); | ||
sb.append(".exe"); | ||
return sb.toString(); | ||
} | ||
}); | ||
|
||
AvailableRunners.put("2.1.0", new RunnerVersion("2.1.0", | ||
new String[]{Runtime.dotNET45}, | ||
new String[]{Platforms.x86, Platforms.MSIL}) { | ||
@Override | ||
public String getRunnerPath(String runtime, String platform) { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("xunit.console"); | ||
if (platform.equals(Platforms.x86)) | ||
sb.append(".x86"); | ||
sb.append(".exe"); | ||
return sb.toString(); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
final class Runtime { | ||
public static final String dotNET35 = ".NET 3.5"; | ||
public static final String dotNET40 = ".NET 4.0"; | ||
public static final String dotNET45 = ".NET 4.5"; | ||
} | ||
final class Platforms { | ||
public static final String MSIL = "AnyCPU/MSIL"; | ||
public static final String x86 = "x86"; | ||
public static final String x64 = "x64"; | ||
} |
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
20 changes: 20 additions & 0 deletions
20
xunit-common/src/test/java/se/capeit/dev/xunittestrunner/RunnersTest.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,20 @@ | ||
package se.capeit.dev.xunittestrunner; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
public class RunnersTest { | ||
@Test | ||
public void testCorrectVersionReturned() { | ||
Assert.assertEquals("2.0.0", Runners.getRunner("2.0.0").version); | ||
} | ||
|
||
@Test | ||
public void testCorrectRunnerPath() { | ||
RunnerVersion runner = Runners.getRunner("1.9.2"); | ||
Assert.assertEquals("xunit.console.clr4.x86.exe", runner.getRunnerPath(Runtime.dotNET40, Platforms.x86)); | ||
Assert.assertEquals("xunit.console.clr4.exe", runner.getRunnerPath(Runtime.dotNET40, Platforms.MSIL)); | ||
Assert.assertEquals("xunit.console.x86.exe", runner.getRunnerPath(Runtime.dotNET35, Platforms.x86)); | ||
Assert.assertEquals("xunit.console.exe", runner.getRunnerPath(Runtime.dotNET35, Platforms.MSIL)); | ||
} | ||
} |
Oops, something went wrong.