-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduced CucumberJUnitRunner - a bridge between Cucumber Features and Android Test Orchestrator #14
Introduced CucumberJUnitRunner - a bridge between Cucumber Features and Android Test Orchestrator #14
Conversation
f7f347e
to
fcd70d3
Compare
@Override | ||
public void onCreate(final Bundle bundle) { | ||
bundle.putString("plugin", getPluginConfigurationString()); // we programmatically create the plugin configuration | ||
bundle.putString(ARGUMENT_ORCHESTRATOR_RUNNER_BUILDER, CucumberJUnitRunnerBuilder.class.getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to pass CucumberJUnitRunnerBuilder
to AndroidJUnitRunner
so then it will automatically be asked to create CucumberJUnitRunner
} | ||
|
||
/** | ||
* Runs the cucumber scenarios with the specified arguments. | ||
*/ | ||
public void execute() { | ||
instrumentationReporter.setNumberOfTests(getNumberOfConcreteScenarios()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to defer a moment of reporting of total tests to right before the execution, because then filtering of tests can be applied:
fcd70d3#diff-9d77d6e39a9caffbbd7c7854efbb2fe0R67
public CucumberJUnitRunner(Class testClass) { | ||
instrumentationRunner = (CucumberAndroidJUnitRunner) InstrumentationRegistry | ||
.getInstrumentation(); | ||
cucumberExecutor = new CucumberExecutor(new Arguments(instrumentationRunner.getArguments()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bundle
arguments are stored in CucumberAndroidJUnitRunner
for backward compatibility with Cucumbers tags/configuring
public class CucumberJUnitRunnerBuilder extends RunnerBuilder { | ||
@Override | ||
public Runner runnerForClass(final Class<?> testClass) { | ||
if (testClass.equals(this.getClass())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is needed for this Builder to work only once - so we run it one Class from tests Classpath - for itself
@@ -96,6 +96,7 @@ spoon { | |||
debug = true | |||
singleInstrumentationCall = true | |||
grantAll = true | |||
shard = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dynamic Spoon sharding
it is strange, but the project doesn't compile for me on cucumber java |
There have been some internal API changes in |
I'll try to check this in next week |
…_orchestrator_integration
I'm currently making small refactoring in this PR: removing duplicates and migrating to androidx and this runner is not working, likely due to changes in androidx.test classes. I'll figure this out and push my changes in few days |
This branch should compile now but it does not execute any tests (at least running from Android Studio). @lifedemons did you tested it? In my opinion it can't work here
because there is a filter which filters out classes not belonging to test package. |
@lsuski |
in order to supply So, this
|
so, please, let me know does clean |
Yes, it works, I've run tests in AS for package and that's was the case. However did you tested it with Android Orchestrator (as PR title suggests) because current configuration does not use it. |
I wasn't able to make it work with orchestrator, however it's not critical feature for me. Sharding is much more useful with large test base |
…der from duplicated code, remove AndroidObjectFactory
@lsuski I agree with you about importancy of sharding vs isolated running of all tests via Android Test Orchestrator, so this PR was intended to bring sharding. |
@lsuski thank you for your feedback 👍 |
@lsuski I've made some progress in Android Test Orchestrators' isolated test Instrumentations: What I see here:
what do you think? |
Cucumber has its own filtering mechanism and I think we should use it instead. I'll try it today |
I've made some enhancements and this should finally work. I'll push my changes here after weekend |
Everything should work now. @lifedemons check this with your project |
@lsuski I've checked - works fine. great job 👍 |
Hi @lifedemons, Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾 In return for this generous offer we hope you will:
On behalf of the Cucumber core team, |
Hi, @lifedemons, @aslakhellesoy. I have an issue with implementation of cucumber with the orchestrator. Could you provide the setting which you use for it? |
This PR proposes the way of integration between Android Test Orchestrator(e.g. AndroidJUnitRunner) and Cucumber for Android.
Essentially:
PickleEvents
- representation of testsJunit Tests/Runners
So, we map List of
PickleEvents
to List ofJUnit Description
via implementing of customCucumberJUnitRunner
As result, this allows:
Spoon
dynamic sharding with Cucumber - when Spoon detects all connected devices and distributes tests between them