java - Testing an Android application failed in Eclipse using Appium -


i wanted learn tool test android application. after bit of googling came around wonderful tool called appium used test android application , open source. wanted learn it. went ahead , created simple android application having few button clicks start testing.

i have done following:

  1. plugged in necessary jar's eclipse ide.
  2. downloaded , installed appium server.
  3. plugged in maven , testng eclipse.
  4. successfullly installed sampleapp.apk emulator.

i next created testng class test sampleapp.apk. code pasted below. on running application received java.lang.nullpointerexception. it's been 2 days. tried doing everything, building, cleaning, restarting eclipse, creating new application, re installing dependencies. still receive same exception. had referred video execute automation , have done exact same minus application different in case.

package com.example.appium;  import java.net.malformedurlexception; import java.net.url; import io.appium.java_client.appiumdriver; import io.appium.java_client.android.androiddriver; import io.appium.java_client.remote.mobilecapabilitytype; import org.junit.beforeclass; import org.openqa.selenium.webelement; import org.openqa.selenium.remote.desiredcapabilities; import org.testng.assert; import org.testng.annotations.test;  public class testjavaappium {      appiumdriver<webelement> driver;      @beforeclass     public void setup() throws malformedurlexception{          desiredcapabilities capability =  new desiredcapabilities();         capability.setcapability(mobilecapabilitytype.device_name, "emulator");         capability.setcapability(mobilecapabilitytype.app_package, "com.example.sampleapp");         capability.setcapability("avd", "emulator4.2");                  driver = new androiddriver<webelement>(new url("http://127.0.0.1:4273/wd/hub"), capability);     }      @test   public void simpletest() {        assert.assertnotnull(driver.getcontext());   } } 

my appium configured below assure had information correct.enter image description here

ideally code should run , launch application (at least did in video) successfully. received instead below exception:

[testng] running:   c:\users\kc\appdata\local\temp\testng-eclipse-518994855\testng-customsuite.xml  failed: simpletest java.lang.nullpointerexception     @ com.example.appium.testjavaappium.simpletest(testjavaappium.java:37)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)     @ java.lang.reflect.method.invoke(unknown source)     @ org.testng.internal.methodinvocationhelper.invokemethod(methodinvocationhelper.java:85)     @ org.testng.internal.invoker.invokemethod(invoker.java:639)     @ org.testng.internal.invoker.invoketestmethod(invoker.java:821)     @ org.testng.internal.invoker.invoketestmethods(invoker.java:1131)     @ org.testng.internal.testmethodworker.invoketestmethods(testmethodworker.java:124)     @ org.testng.internal.testmethodworker.run(testmethodworker.java:108)     @ org.testng.testrunner.privaterun(testrunner.java:773)     @ org.testng.testrunner.run(testrunner.java:623)     @ org.testng.suiterunner.runtest(suiterunner.java:357)     @ org.testng.suiterunner.runsequentially(suiterunner.java:352)     @ org.testng.suiterunner.privaterun(suiterunner.java:310)     @ org.testng.suiterunner.run(suiterunner.java:259)     @ org.testng.suiterunnerworker.runsuite(suiterunnerworker.java:52)     @ org.testng.suiterunnerworker.run(suiterunnerworker.java:86)     @ org.testng.testng.runsuitessequentially(testng.java:1185)     @ org.testng.testng.runsuiteslocally(testng.java:1110)     @ org.testng.testng.run(testng.java:1018)     @ org.testng.remote.remotetestng.run(remotetestng.java:111)     @ org.testng.remote.remotetestng.initandrun(remotetestng.java:204)     @ org.testng.remote.remotetestng.main(remotetestng.java:175)   ===============================================     default test     tests run: 1, failures: 1, skips: 0 ===============================================   =============================================== default suite total tests run: 1, failures: 1, skips: 0 ===============================================  [testng] time taken org.testng.reporters.jq.main@6d9c638: 225 ms [testng] time taken org.testng.reporters.suitehtmlreporter@7fbe847c: 230 ms [testng] time taken [failedreporter passed=0 failed=0 skipped=0]: 26 ms [testng] time taken org.testng.reporters.xmlreporter@5e265ba4: 14 ms [testng] time taken org.testng.reporters.junitreportreporter@2401f4c3: 14 ms [testng] time taken org.testng.reporters.emailablereporter2@182decdb: 12 ms 

where possibly might have gone wrong anger eclipse?

code looks good. provide app activity.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -