2

I was using Pydev on Eclipse. I understand if I have a Eclipse folder with 5 files containing unit-tests, I can run these tests once by right-clicking on the name of the folder in Eclipse, choosing "Run-As" --> "Python unit-test". This works fine for me.

What would be the recommended way to run these tests for the fixed number of times? For example, if I wanted to run the 5 tests in the folder 10 times each?

I would be very grateful if you could help me out.

Thanks!

2
  • Why are you trying to do this? I can't think of any reason to run the same tests 10 times in a row. It sounds like you're trying to profile you code, but running all your tests 10 times is not the way to do it. Commented Jan 7, 2014 at 8:20
  • Hi Aquavitae, I am running UI tests based on image recognition (using Sikuli). To test the fact that the tests are reliably identifying the images I give it, I wanted to run it X number of times and make sure that there are no failures... Commented Jan 7, 2014 at 8:37

1 Answer 1

1

I think that the problem is in the way you are constructing your tests. There are a two problems I see:

  1. If tests are failing because of poor image recognition, then surely they indicate either a bug in Sikuli, or a badly designed test. Unit tests should be predictable and repeatable, so requiring that they run several times indicates that they are not well set up.

  2. If you really do need to run the UI tests mutliple times, then this should be done in the code, not in the IDE, since you can't guarantee that they will always be run in that environment (e.g. what if you want to move to CI?). So you need something like this in your code:

    def test_ui_component(self): for i in range(1): # Test code here

    You could probably abstract the pattern out using a decorator or class inheritance if you really want to.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.