Comments (14)
Thanks for your time on this. I'm sure it will help 100s of people!
I ran the connectedAndroidTest as advised which completed successfully.
I edited the tags in the scenarios of the feature file to @login-scenario1, @login-scenario2, @login-scenario3
I added-Ptags="@login-scenario2" to Script parameters and re-ran the script.
SUCCESS! Only the 2nd scenario was executed.
The question remains however... Does Android Studio allow the more user friendly and visually appealing execution of feature files as quoted above?
from cleanguitestarchitecture.
Indeed, that's not possible because it's not how Cucumber recognizes tests.
Tests are recognized by tags rather than files or folders.
In addition, tags can be added before a "Feature: ..." line, not only before a "Scenario: ..." line. Example:
@login-feature
Feature: Login in the application
@ScenarioId("FUNCTIONAL.AUTH.SCN.001") @UserStory("MyApp-135") @login-scenarios
Scenario: User can login with valid user name and password
Given I see the login page
When I login with user name "Sebas" and password "passion"
Then I see the welcome page
And the title is "Welcome Sebas"
@ScenarioId("FUNCTIONAL.AUTH.SCN.002") @UserStory("MyApp-135") @login-scenarios
Scenario: User can login with valid second user name and password
Given I see the login page
When I login with user name "sebaslogen" and password "passion"
Then I see the welcome page
And the title is "Welcome sebaslogen"
from cleanguitestarchitecture.
Thanks @sebaslogen for the insight. I had to tweak a little on the project structure and finally it did work.
from cleanguitestarchitecture.
Hi,
Can you explain in more detail how are trying and failing to run the tests?
You can run tests from the IDE and from the command line but the execution is not filtered per file, but rather by tags (all tests are executed if no tag is given as filter). For more info see #15
from cleanguitestarchitecture.
I attempted the following steps...
- Select the Android view in the project pane.
- Expand the folder app/assets/features(androidTest)
- Right-click login.feature
from cleanguitestarchitecture.
The examples given pertain to running the test from the command line which works as expected in my environment. I guess my question is, how is it possible to run cucumber feature tests using Android Studio GUI using the Run window / toolbar run buttons? Can tags be used somewhere in the Run/Debug Configuration?
from cleanguitestarchitecture.
...The intellij documentation instructions seem to suggest right-clicking on feature files is doable.
https://www.jetbrains.com/help/idea/running-cucumber-tests.html
Running Cucumber Tests
The Cucumber feature files are run same way as the other executables, with certain run/debug configuration settings.
Prior to running a test, you have to set up run/debug configuration for a particular feature file or scenario, or for the whole bunch of features within a directory. Creating a run/debug configuration is described in the section Creating and Editing Run/Debug Configurations.
However, there is always the possibility to run Cucumber tests with the default settings, which is described below.
Results of tests execution are displayed in the Test Runner tab of the Run tool window.
To run all feature files in a directory
In the Project tool window, right-click the directory where the feature files are stored.
On the context menu of the directory, choose Run all features in .
Does Android Studio not inherit this functionality?
from cleanguitestarchitecture.
In Android Studio, run connectedAndroidTest in the right Gradle tab and then edit the run configuration to add under the Script parameters
something like -Ptags="@login-scenarios,@kitkat"
Let me know if it works.
As for the IntelliJ feature I have no info.
from cleanguitestarchitecture.
Hello,
The connectedAndroidTest with script parameters doesn't seem to filter my scenarios based on tags.
Should the build.gradle file be instructed about the usage of -Ptags parameter?
My cucumber runner looks like below, I do not use a CucumberTestCase file that has other added properties.
@CucumberOptions(features = "features")
public class CucumberInstrumentationRunner extends MonitoringInstrumentation {
private final CucumberInstrumentationCore instrumentationCore = new
CucumberInstrumentationCore(this);
@Override
public void onCreate(final Bundle bundle) {
super.onCreate(bundle);
instrumentationCore.create(bundle);
start();
}
@Override
public void onStart() {
waitForIdleSync();
instrumentationCore.start();
}
}
from cleanguitestarchitecture.
@ArunaBalasubramanian the -Ptags is already handled in the build.gradle here, so I'm not sure what is the difference between your configuration and what @willpowr has already running.
Maybe try restoring the CucumberTestCase class and see if that helps.
from cleanguitestarchitecture.
Thanks @sebaslogen for your response.
This is my build.gradle. Do you see anything that needs change?
Adding a CucumberTestCase is throwing me "cucumber.runtime.CucumberException: No CucumberOptions annotation". I tried solving using #3, but didn't help.
from cleanguitestarchitecture.
@ArunaBalasubramanian I don't see anything wrong with your build.gradle
As for the CucumberTestCase the easiest way is to copy the files and structure under androidTest folder of this sample project, start by reducing the feature and steps to a simple step opening the app and then get it running.
from cleanguitestarchitecture.
how do you add the features(android test) folder on assets directory?
from cleanguitestarchitecture.
@amesandy you can create the folder structure using the file explorer of your OS. Just follow the same path structure as the code in this repository
from cleanguitestarchitecture.
Related Issues (20)
- Questions : no test were found HOT 2
- Gradle Tasks failed after execution HOT 2
- Run specific feature HOT 1
- Cucumber reports are not generated HOT 7
- Exception while taking the screenshot HOT 2
- Running feature seems to fail. HOT 3
- Only works for Android 5.1 HOT 3
- How to run multi step definitions file HOT 6
- Question : Reset app state between scenario HOT 1
- Getting "cucumber.runtime.CucumberException" error on running the "StepDefinitions" HOT 19
- Spoon report and screenshots HOT 3
- Getting error "java.lang.AbstractMethodError at cucumber.runtime.UndefinedStepsTracker" HOT 1
- Unable to find element in a webview using onWebView method after SDK 27 update HOT 1
- Getting pending exception when i run my runner file in cucumber HOT 2
- Issue java.lang.NoSuchMethodError: com.aventstack.extentreports.reporter.ExtentHtmlReporter.loadXMLConfig(Ljava/io/File;)
- Cucumber Tests to be run in JMeter. Getting "Could not initialize class io.cucumber.core.options.PluginOption" HOT 2
- Trace -- java.lang.NoSuchMethodError: io.cucumber.tagexpressions.TagExpressionParser: method 'void <init>()' not found
- JENIKS: GRADLE: TESTNG: CUCUMBER FEATURE File: testrunner is faling on jekins pipeline only HOT 2
- plugin in Cucumber runner class are showing attribute undefined. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cleanguitestarchitecture.