@@ -30,12 +30,13 @@ public static class RunOptions {
30
30
private int port ;
31
31
private String path ;
32
32
private String appCmd ;
33
+ private int closeDelay ;
33
34
34
35
public RunOptions () {
35
- this (10 , false , 6789 , "." );
36
+ this (10 , false , 6789 , "." , 0 );
36
37
}
37
38
38
- public RunOptions (int delay , boolean debug , int port , String path ) {
39
+ public RunOptions (int delay , boolean debug , int port , String path , int closeDelay ) {
39
40
if (delay < 0 ) {
40
41
throw new IllegalArgumentException ("Delay must be a positive integer." );
41
42
}
@@ -52,6 +53,11 @@ public RunOptions(int delay, boolean debug, int port, String path) {
52
53
throw new IllegalArgumentException ("Port must be a positive integer." );
53
54
}
54
55
this .port = port ;
56
+
57
+ if (closeDelay < 0 ) {
58
+ throw new IllegalArgumentException ("CloseDelay must be a positive integer." );
59
+ }
60
+ this .closeDelay = closeDelay ;
55
61
}
56
62
57
63
// Getters and setters
@@ -66,6 +72,17 @@ public void setDelay(int delay) {
66
72
this .delay = delay ;
67
73
}
68
74
75
+ public int getCloseDelay () {
76
+ return closeDelay ;
77
+ }
78
+
79
+ public void setCloseDelay (int closeDelay ) {
80
+ if (closeDelay < 0 ) {
81
+ throw new IllegalArgumentException ("CloseDelay must be a positive integer." );
82
+ }
83
+ this .closeDelay = closeDelay ;
84
+ }
85
+
69
86
public boolean isDebug () {
70
87
return debug ;
71
88
}
@@ -539,6 +556,12 @@ public static void runTests(String jarPath, RunOptions runOptions) {
539
556
waitForTestRunCompletion (testRunId , testSet , appId );
540
557
541
558
try {
559
+ if (runOptions .getCloseDelay () > 0 ){
560
+ logger .info ("waiting for {} seconds before closing the application in order to get coverage of async calls" , runOptions .getCloseDelay ());
561
+ //wait for closeDelay in order to get coverage of async calls as well
562
+ Thread .sleep (runOptions .getCloseDelay () * 1000 );
563
+ }
564
+
542
565
Keploy .FindCoverage (testSet );
543
566
544
567
Thread .sleep (5000 );
0 commit comments