tingsu / Stoat

Stoat (STochastic model App Tester) - an automatic testing tool for android apps
https://tingsu.github.io/files/fse17-stoat.pdf
143 stars 37 forks source link

Confusion about iterations and events #13

Closed Earthwater closed 5 years ago

Earthwater commented 5 years ago

--max_event, the meaning provided by stoat is the max num of executed events

But, with serious check, it firstly be passed to a3e by '--events' (treated as $g_maximum_events ), and then the variable compared with this $g_maximum_events is $default_A3E_iteration.

However, one iteration may have many events that could be executed.

Hence, here may exist some confusion

tingsu commented 5 years ago

You are right. --max_event and $g_maximum_events indicate the maximal number of events that are allowed to construct the app model.

At one iteration, Stoat only sends one event. So it makes senses to compare $g_maximum_events with $default_A3E_iteration. In rec.rb, $default_A3E_iteration increases one time when one event is executed (see this code line)

https://github.com/tingsu/Stoat/blob/956ed3e5ec752b2609f1fb0616e6822cb065bd35/Stoat/a3e/bin/rec.rb#L737

Let me know if you still have confusion.

Earthwater commented 5 years ago

Thanks a lot! The iteration equals to actions in FSM period indeed.

But i also noticed that in MCMC sampling period, the mcmc_iteration(default set as 500 when invoke agentManager.rb) usually be very small like 6(while the iteration could be 200 with 20 minutes and 2s delay in FSM period),so does that mean the mcmc_iteration in MCMC sampling period is not same as actions in meaning.

If it is yes, how could i set the max actions allowed to be executed during MCMC sampling period as the setting of '--max_event' in FSM period?

Thanks a lot!

tingsu commented 5 years ago

Okay. I understood what is your confusion. Let me illustrate this.

In model construction (fsm), the option --max_event specifies the maximum number of events that are allowed to explore the app.

In MCMC sampling (mcmc), Stoat does not use the option --max_event to constrain the testing resource. As you can see this line:

https://github.com/tingsu/Stoat/blob/956ed3e5ec752b2609f1fb0616e6822cb065bd35/Stoat/bin/run_stoat_testing.rb#L305

Stoat uses the option --max_iteration to specifiy the maximum allowed resource. In MCMC sampling, each iteration will generate a set of test cases (i.e., a test suite, one test case therein corresponds to a sequence of events) to execute. It then guides the test suite generation during each iteration.

You can also refer to this tool paper for more details (https://tingsu.github.io/files/nasac2017-stoat.pdf)

Earthwater commented 5 years ago

Thanks very much! I understand it now. Very appreciate it.