Unable to run the appium test with junit test runner using 2.0.0-beta.40 Appium Server
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 752
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 8
Description
The problem
I ran into this issue recently where-in am trying to run my suite through test runner but unfortunately am getting java.lang.ExceptionInInitializerError, Instead i am able to run the individual feature file successfully one by one, I tried to downgrade appium server but didn't help, a similar issue has been raised by multiple people but not specific with the JUnit test runner ( https://github.com/appium/java-client/issues/1619 ), I am able to start the appium server but it fails at the
PageFactory.initElements(new AppiumFieldDecorator(driver), this);
with java.lang.ExceptionInInitializerError
Environment
- Appium version (or git revision) that exhibits the issue: 2.0.0-beta.40
- Last Appium version that did not exhibit the issue - I don't remember I have tried with test runner before
- Desktop OS/version used to run Appium: v1.22.3
- Node.js version (unless using Appium.app|exe): v18.7.0
- Npm or Yarn package manager: 8.15.0
- Mobile platform/version under test: android ( same issue occurs on ios as well )
- Real device or emulator/simulator: real device
- Appium CLI or Appium.app|exe:
Details
I am able to run the individual cucumber features successfully but can't run only with the Junit test runner, I compared the capabilities as well but not sure what's wrong, I could really use expertise from this group to help me out on this issue, I am completely stuck at this moment.
Link to Appium logs
(https://gist.github.com/cnerkar1859/1eddb9ed212d3053839307525007f708)
Code To Reproduce Issue [ Good To Have ]
public class MyVfLoginPage {
public MyVfLoginPage(AppiumDriver driver) {
this.driver = driver;
PageFactory.initElements(new AppiumFieldDecorator(driver), this); // It's failing while iniatilising the elements
}
@AndroidFindBy(xpath = "//*[@resource-id='signin_txtUsername']")
@iOSXCUITFindBy(id = "signin_txtUsername")
public WebElement txtUsername;
}
}
NOTE - If I change the above code to
using PageFactory.initElements(driver, this); with @FindBy it goes through successfully
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the failing PageFactory.initElements(new AppiumFieldDecorator(driver), this) call in MyVfLoginPage and compare it with the working PageFactory.initElements(driver, this) path. Review the linked Appium logs and issue 1619, then reproduce with the JUnit runner on Android or iOS. Done means the annotated page object initializes successfully under the runner, with a regression test if the project provides a relevant test location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- mobile-dev, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100