Skip to content

Latest commit

 

History

History

Useful scripts for VET

This directory contains scripts that help realize VET's algorithms. You will need to install the zss package for these Python scripts to run properly:

$ pip3 install zss

Assume that you have already collected a trace in a folder named TRACE_ID in the root directory of TOLLER's repo, you can use the following commands to process this trace:

  • First, convert concrete UI hierarchies to abstract UI states.

    $ python3 useful-scripts-vet/preprocess-trace.py {TRACE_ID}

    Now you should see a folder named processed_traces with a new file named {TRACE_ID}.pickle.

  • Then, pre-calculate the pairwise similarities between abstract UI states.

    $ python3 useful-scripts-vet/preprocess-sim.py {TRACE_ID}

    Now you should see a folder named processed_sims with a new file named {TRACE_ID}.pickle.

  • Exploration Space Partition detection

    $ python3 useful-scripts-vet/detect-partition.py {TRACE_ID}

    Now you should see a folder named detect_partition with a new file named {TRACE_ID}.json.

  • Excessive Local Exploration detection

    $ python3 useful-scripts-vet/detect-trapped.py {TRACE_ID}

    Now you should see a folder named detect_trapped with a new file named {TRACE_ID}.json.

Each JSON file generated by two detection algorithms contains a list of detected regions, each in the format of [{TS_ACTION}, {TS_REGION_BEGIN}, {TS_REGION_END}]. See {TRACE_ID}/{TS_ACTION}.json for the UI hierarchy with the action that the algorithm thinks to have caused the corresponding type of exploration tarpit.

Assume that for some (tool,app) pair, you have one or more traces with detected regions. Now it's time to rank these regions based on their lengths (as mentioned in the paper):

$ CT_REGIONS=3 python3 useful-scripts-vet/generate-actions.py "{TOOL_ID}-{APP_ID}-top3" {TRACE_ID1} {TRACE_ID2} ...

Now you should see a folder named prevent_actions with a new file named {TOOL_ID}-{APP_ID}-top3.json. This JSON file has the same format as those in regions.tar.bz2 from our experiment data. In the example, up to top 3 regions will be recorded.

Finally, you can tell the test recorder (that controls TOLLER) to enforce the list of prevented actions in new runs:

$ XPATHS_TO_KILL=$(python3 useful-scripts-vet/combine-actions.py "{TOOL_ID}-{APP_ID}-top3" | xargs python3 test-recorder/get-source-xpath.py) \
  WATCHDOG_INTV=30000 CTRL_PORT={CTRL_PORT} MINICAP_PORT={MINICAP_PORT} \
    java -jar test-recorder/TestRecorder.jar {OUT_DIR} {SCREEN_OUT_DIR}