I have written a suite of tests for our company's Android app using Android JUnit and Robotium.

I have written a Utility that can enable and disable networking for a device.

My Question is: "Is there an easy way to run a JUnit Test with parameters?".

I would like to be able to run these test under normal network conditions, and then again when the network cuts out mid test, but I do not want to be copying and pasting tests

1 Answer 1


I recommend that you create a custom wrapper for your tests. Put this as a call for your test initialization so that it will fire on all your tests, but the code for managing it will all be in a single place. Read from a property or config file the parameter to indicate "normal" and "cut out".

I'm assuming that your "mid test" has a timer or something to manage this? There could be some trickiness and possible threading that is necessary depending on what is managing this...please provide more info on this part if this doesn't answer the full question.

  • I have already created a method that handles creating a thread and then waits a set period of time before disabling/enabling network connection. So your answer works.
    – nerdy900
    Commented Aug 15, 2014 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.