aboutsummaryrefslogtreecommitdiffstats
path: root/it
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-05-25 11:11:23 +0200
committerStas Vilchik <vilchiks@gmail.com>2016-05-25 11:11:23 +0200
commit4f3e366aa1681904975772b0a3f8fa450c927ec6 (patch)
tree73bf7381a7c4a3d6b8b90a6afe3c38b2321181c0 /it
parentebe76781de3b2d031ed439052b13d3be0a48b135 (diff)
downloadsonarqube-4f3e366aa1681904975772b0a3f8fa450c927ec6.tar.gz
sonarqube-4f3e366aa1681904975772b0a3f8fa450c927ec6.zip
fix TechnicalDebtWidgetTest by using dynamic date
Diffstat (limited to 'it')
-rw-r--r--it/it-tests/src/test/java/it/qualityModel/TechnicalDebtWidgetTest.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtWidgetTest.java b/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtWidgetTest.java
index 989545d9ec9..7350325bff8 100644
--- a/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtWidgetTest.java
+++ b/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtWidgetTest.java
@@ -24,6 +24,7 @@ import com.sonar.orchestrator.build.SonarRunner;
import com.sonar.orchestrator.locator.FileLocation;
import com.sonar.orchestrator.selenium.Selenese;
import it.Category2Suite;
+import org.apache.commons.lang.time.DateUtils;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
@@ -31,6 +32,9 @@ import org.junit.experimental.categories.Category;
import util.QaOnly;
import util.selenium.SeleneseTest;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
import static util.ItUtils.projectDir;
@Category(QaOnly.class)
@@ -55,8 +59,8 @@ public class TechnicalDebtWidgetTest {
// need to execute the build twice in order to have history widgets
// we made some exclusions to have variations in diff mode
- scanProject("2011-06-01", "**/a2/**");
- scanProject("2012-02-01", "");
+ scanProject(getPastDate(20), "**/a2/**");
+ scanProject(getPastDate(10), "");
}
private static void scanProject(String date, String excludes) {
@@ -93,4 +97,8 @@ public class TechnicalDebtWidgetTest {
).build()).runOn(orchestrator);
}
+ private static String getPastDate(int nbPastDays){
+ return new SimpleDateFormat("yyyy-MM-dd").format(DateUtils.addDays(new Date(), nbPastDays * -1));
+ }
+
}