iOS: Re-running a test should respect shouldRunOnMainThread. #76

Closed
wants to merge 2 commits into
from

Projects

None yet

4 participants

@Inferis
Inferis commented Jan 24, 2012

If you re-ran a test, the test was always run on the main thread. This is different behavior from the runs in the complete test suite.

These commits pass along the test group with the test to the detail controller, which then uses the context of the group to re-run the test. It actually creates a new group with the same context, with only (a copy of) the test to re-run in it.

Inferis added some commits Jan 24, 2012
@Inferis Inferis Added initWithGroup to GHTestGroup. 776290c
@Inferis Inferis GHUnitIOSTestViewController now requires to be passed a test and its …
…group.

setTest: was modified to setTest:group:

This is necessary to properly rerun the test. Without the group the testCase's shouldRunOnMainThread isn't called, giving different behavior from this particular rerun versus the testsuite run.
23fa318
@x2on
Member
x2on commented Feb 17, 2012

+1
Thanks for this, i integrated this and it runs fine.

@drekka
drekka commented Feb 19, 2012

Not sure if I've read this correctly, but I've just encountered a problem where a test works fine when run from the suite view, but crashes when run from the test view. The issue is the test includes threading code which assumes that it is not running on the main thread, but GHUnit runs the test on the main thread when the Run button is tapped.

I think I have the inverse of this bug in that I don't want it run on the main thread.

@Inferis
Inferis commented Feb 20, 2012

My changes will fix that.

@x2on
Member
x2on commented Oct 30, 2013

Is this relevant for the current master?

@x2on x2on closed this Feb 17, 2014
@kolyuchiy

Yes, it's still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment