mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
feat(test): add --clear-data flag to clear app data on launch
This commit is contained in:
1 parent
c76745e5f1
commit
d489000f63
3 files changed
+5
-1
No files matched your search
@@ -23,6 +23,7 @@ type testOptions struct {
|
|||||||
duration time.Duration
|
duration time.Duration
|
||||||
seed int64
|
seed int64
|
||||||
output string
|
output string
|
||||||
|
clearData bool
|
||||||
}
|
}
|
||||||
|
|
||||||
const topUsage = `sanderling is a property-based UI fuzzer for mobile apps.
|
const topUsage = `sanderling is a property-based UI fuzzer for mobile apps.
|
||||||
@@ -51,6 +52,7 @@ func parseTestArgs(args []string, stderr io.Writer) (testOptions, error) {
|
|||||||
flagSet.DurationVar(&options.duration, "duration", 5*time.Minute, "total test duration")
|
flagSet.DurationVar(&options.duration, "duration", 5*time.Minute, "total test duration")
|
||||||
flagSet.Int64Var(&options.seed, "seed", 0, "RNG seed (0 = random)")
|
flagSet.Int64Var(&options.seed, "seed", 0, "RNG seed (0 = random)")
|
||||||
flagSet.StringVar(&options.output, "output", "./runs", "output directory for traces")
|
flagSet.StringVar(&options.output, "output", "./runs", "output directory for traces")
|
||||||
|
flagSet.BoolVar(&options.clearData, "clear-data", false, "clear app data before launching so the run starts from a fresh install")
|
||||||
if err := flagSet.Parse(args); err != nil {
|
if err := flagSet.Parse(args); err != nil {
|
||||||
return testOptions{}, err
|
return testOptions{}, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,5 +17,6 @@ func runTestPipeline(ctx context.Context, options testOptions, stdout io.Writer)
|
|||||||
Duration: options.duration,
|
Duration: options.duration,
|
||||||
Seed: options.seed,
|
Seed: options.seed,
|
||||||
Output: options.output,
|
Output: options.output,
|
||||||
|
ClearData: options.clearData,
|
||||||
}, stdout)
|
}, stdout)
|
||||||
}
|
}
|
||||||
@@ -29,6 +29,7 @@ type Options struct {
|
|||||||
Duration time.Duration
|
Duration time.Duration
|
||||||
Seed int64
|
Seed int64
|
||||||
Output string
|
Output string
|
||||||
|
ClearData bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute runs the full test pipeline: bundle, launch app, verify properties.
|
// Execute runs the full test pipeline: bundle, launch app, verify properties.
|
||||||
@@ -68,7 +69,7 @@ func Execute(ctx context.Context, options Options, stdout io.Writer) error {
|
|||||||
}
|
}
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
if err := activeDriver.Launch(ctx, options.BundleID, false, nil); err != nil {
|
if err := activeDriver.Launch(ctx, options.BundleID, options.ClearData, nil); err != nil {
|
||||||
return fmt.Errorf("launch app: %w", err)
|
return fmt.Errorf("launch app: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user