Skip to content

Commit

Permalink
chore: Functional test fixes & improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
rsenden committed Jul 13, 2023
1 parent 494b6d5 commit fbf222f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
runNumber: # Accessible through ${{ inputs.runNumber }}
description: 'Optional workflow run number for which to perform functional tests'
description: 'Required "Build and release"" workflow run number from which to get artifacts to be tested'
required: true
type: number
workflow_run:
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
java -jar -Dft.fcli=fcli.exe fcli-ftest.jar ;;
"macos-latest" )
tar -zxvf fcli-mac.tgz
./gradlew ftest -Dft.fcli=./fcli ;;
java -jar -Dft.fcli=./fcli fcli-ftest.jar ;;
esac ;;
esac
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public class TestRunner {
static def orgOut = System.out
static def orgErr = System.err
public static void main(String[] args) {
new PrintStream(new File("test.log")).withCloseable
{ log ->
def exitCode = 0
new PrintStream(new File("test.log")).withCloseable { log ->
final LauncherDiscoveryRequest request =
LauncherDiscoveryRequestBuilder.request()
.selectors(DiscoverySelectors.selectPackage("com.fortify.cli.ftest"))
Expand All @@ -35,11 +35,13 @@ public class TestRunner {
TestExecutionSummary summary = summaryListener.getSummary();
new PrintWriter(log).withCloseable { summary.printTo it }
new PrintWriter(orgOut).withCloseable { summary.printTo it }
exitCode = summary.totalFailureCount>0 ? 1 : 0
} finally {
System.out = orgOut
System.err = orgErr
}
}
}
System.exit(exitCode)
}

private static class FcliTestExecutionListener implements TestExecutionListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import com.fortify.cli.ftest._common.spec.Prefix

@Prefix("core.basic-info")
class BasicInfoSpec extends BaseFcliSpec {
def "testGitHubFailure"() {
expect:
true==false
}

def "help"(String[] args, boolean expectSuccess) {
expect:
fcli(args)==expectSuccess
Expand Down

0 comments on commit fbf222f

Please sign in to comment.