Skip to content

Commit

Permalink
Env-based configuration of tests adjustments.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed Nov 20, 2016
1 parent 1428c08 commit 8cbac3c
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -42,7 +42,7 @@
*/
public abstract class TestCommons {

protected static final boolean ADJUST_RESULTS = false;
protected static final boolean ADJUST_TESTS = "true".equalsIgnoreCase(System.getProperty("adjustTests"));

protected static final Random RND = new Random();

Expand All @@ -64,15 +64,16 @@ public static void beforeTests() {
@Before
public final void initTest() {
System.out.println("--------------------------------------------------------------------------------");
System.out.println(" @" + ManagementFactory.getRuntimeMXBean().getName() + " TEST " + getClass().getCanonicalName());
String info = ADJUST_TESTS ? " [ADJUST]" : "";
System.out.println(" @" + ManagementFactory.getRuntimeMXBean().getName() + " TEST " + getClass().getCanonicalName() + info);
System.out.println("--------------------------------------------------------------------------------");

hasError = false;

String s = File.separator;
String resultsDir = "src" + s + "test" + s + "resources" + s + TEST_RESULTS_FOLDER + s + getTestName();

if (!initialized && ADJUST_RESULTS) {
if (!initialized && ADJUST_TESTS) {
File testDir = new File(resultsDir);

if (testDir.isDirectory()) {
Expand Down Expand Up @@ -595,7 +596,7 @@ protected void verifyCase(String info, String actual, String testCaseName) {
String resname = TEST_RESULTS_FOLDER + s + getTestName() + s + getTestMethodName() + s + testCaseName;
String filename = "src" + s + "test" + s + "resources" + s + resname;

if (ADJUST_RESULTS) {
if (ADJUST_TESTS) {
synchronized (this) {
File testDir = new File(filename).getParentFile();

Expand Down

0 comments on commit 8cbac3c

Please sign in to comment.