Skip to content

Commit

Permalink
generate random test data with covered file each time
Browse files Browse the repository at this point in the history
  • Loading branch information
teryk committed May 8, 2015
1 parent 301e576 commit a0dcad8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -57,6 +57,7 @@ public class IndexTestsStepTest extends BaseStepTest {
@Before @Before
public void setUp() { public void setUp() {
dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new FileSourceDao(null)); dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new FileSourceDao(null));
esTester.truncateIndices();
} }


@Override @Override
Expand All @@ -72,7 +73,7 @@ public void supported_project_qualifiers() {
} }


@Test @Test
public void index_source() throws Exception { public void index_test() throws Exception {
dbTester.prepareDbUnit(getClass(), "index_source.xml"); dbTester.prepareDbUnit(getClass(), "index_source.xml");
Connection connection = dbTester.openConnection(); Connection connection = dbTester.openConnection();
TestTesting.updateDataColumn(connection, "FILE1_UUID", TestTesting.newRandomTests(1)); TestTesting.updateDataColumn(connection, "FILE1_UUID", TestTesting.newRandomTests(1));
Expand Down
Expand Up @@ -65,8 +65,7 @@ public static List<FileSourceDb.Test> newRandomTests(int numberOfTests) throws I
.setStacktrace(RandomStringUtils.randomAlphanumeric(50)) .setStacktrace(RandomStringUtils.randomAlphanumeric(50))
.setMsg(RandomStringUtils.randomAlphanumeric(30)) .setMsg(RandomStringUtils.randomAlphanumeric(30))
.setExecutionTimeMs(RandomUtils.nextLong()); .setExecutionTimeMs(RandomUtils.nextLong());
int numberOfCoveredFiles = RandomUtils.nextInt(10); for (int j = 0; j < numberOfTests; j++) {
for (int j = 0; j < numberOfCoveredFiles; j++) {
test.addCoveredFile( test.addCoveredFile(
FileSourceDb.Test.CoveredFile.newBuilder() FileSourceDb.Test.CoveredFile.newBuilder()
.setFileUuid(Uuids.create()) .setFileUuid(Uuids.create())
Expand Down

0 comments on commit a0dcad8

Please sign in to comment.