Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acceptance test framework usability and failing test performance fix #25

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import java.io.IOException;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;

public class GenericCliProcessStepDefs {

private static final int OUTPUT_TIMEOUT = 30000;
private static final String jarFile = "../ticket-service/target/ticket-service-0.0.1-SNAPSHOT.jar";

private ProcessUnderTest cliProcess;

Expand All @@ -23,6 +26,9 @@ public GenericCliProcessStepDefs(ProcessUnderTest cliProcess) {

@Given("the application is started")
public void applicationStarted() throws IOException, InterruptedException {
if (!(new File(jarFile)).isFile()){
throw new FileNotFoundException("The path " + jarFile + " does not exist. It should be your built JAR file.");
}
cliProcess.run("java -jar -Dspring.profiles.active=ci ../ticket-service/target/ticket-service-0.0.1-SNAPSHOT.jar");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ private void clearOutput(long delayBeforeCleaning) throws IOException {
private Void readOutputUntil(String expectedOutput) throws IOException {
String actualString = "";
do {
actualString += (char) output.read();
int c = output.read();
if (c == -1) {
throw new IOException("Reached EOF before receiving '" + expectedOutput + "'");
}
actualString += (char) c;
if (actualString.length() > expectedOutput.length()) {
actualString = actualString.substring(1);
}
Expand Down