Библиотека ExtentReport в тесте Espresso выдает ошибку "java.lang.NoClassDefFoundError: Не удалось разрешить: Ljava/beans/Introspector;"

Я работаю над инструментом Espresso для автоматизации тестирования пользовательского интерфейса приложения Android с помощью Android Studio. Я получаю ниже проблемы каждый раз при запуске теста эспрессо.

Версия Android Studio: 3.1.3, версия библиотеки отчетов Extent: 2.4.0, версия Java: 1.8.0.151, JAVA_OPTIONS: -Xmx512M Операционная система: Windows 7 (64-разрядная версия)

мой код:

@LargeTest
@RunWith(AndroidJUnit4.class)
public class test123 {
    public static ExtentTest logger;
    public static ExtentReports extent;

    @Rule
    public ActivityTestRule<StartMyActivity> mActivityTestRule = new ActivityTestRule<>(StartMyActivity.class);

    @Test
    public void test3_test() throws Exception {
        extent = new ExtentReports("C://Report//abc.html", true);
         step1 code ...
          step 2 code ..
}
}

Выход:

Testing started at 15:13 ...

    07/22 15:13:19: Launching test3_MV2PRCFAC_11_I...
    $ adb push C:\User1\EspressoTest\app\build\outputs\apk\formation\debug\app-formation-debug-V0.4.4.apk /data/local/tmp/net.abc.pqr
    $ adb shell pm install -t -r "/data/local/tmp/net.abc.pqr"
        pkg: /data/local/tmp/net.abc.pqr
    Success


    No apk changes detected since last installation, skipping installation of C:\User1\EspressoTest\app\build\outputs\apk\androidTest\formation\debug\app-formation-debug-androidTest.apk
    Running tests

    $ adb shell am instrument -w -r   -e debug false -e class 'net.abc.pqr.ui.TestScripts.test3' net.abc.pqr.test/android.support.test.runner.AndroidJUnitRunner
    Client not ready yet..
    Started running tests

    java.lang.NoClassDefFoundError: Failed resolution of: Ljava/beans/Introspector;
    at freemarker.ext.beans.ClassIntrospector.addBeanInfoToClassIntrospectionData(ClassIntrospector.java:306)
    at freemarker.ext.beans.ClassIntrospector.createClassIntrospectionData(ClassIntrospector.java:274)
    at freemarker.ext.beans.ClassIntrospector.get(ClassIntrospector.java:244)
    at freemarker.ext.beans.ClassBasedModelFactory.getInternal(ClassBasedModelFactory.java:99)
    at freemarker.ext.beans.ClassBasedModelFactory.get(ClassBasedModelFactory.java:47)
    at freemarker.ext.beans._EnumModels.get(_EnumModels.java:28)
    at com.relevantcodes.extentreports.HTMLReporter.start(HTMLReporter.java:80)
    at com.relevantcodes.extentreports.Report.attach(Report.java:318)
    at com.relevantcodes.extentreports.ExtentReports.<init>(ExtentReports.java:86)
    at com.relevantcodes.extentreports.ExtentReports.<init>(ExtentReports.java:375)
    at net.abc.pqr.ui.TestScripts.test3.test3(test3.java:53)
    at java.lang.reflect.Method.invoke(Native Method)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:527)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at android.support.test.runner.AndroidJUnit4.run(AndroidJUnit4.java:101)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
    at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
    at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:384)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1984)
    Caused by: java.lang.ClassNotFoundException: Didn't find class "java.beans.Introspector" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/net.abc.pqr.test-2/base.apk", zip file "/data/app/net.abc.pqr-2/base.apk"],nativeLibraryDirectories=[/data/app/net.abc.pqr.test-2/lib/arm, /data/app/net.abc.pqr-2/lib/arm, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 41 more
    Suppressed: java.lang.ClassNotFoundException: java.beans.Introspector
    at java.lang.Class.classForName(Native Method)
    at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
    at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
    ... 42 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

    Tests ran to completion.




    Testing started at 15:13 ...

    07/22 15:13:19: Launching test3_MV2PRCFAC_11_I...
    $ adb push C:\User1\EspressoTest\app\build\outputs\apk\formation\debug\app-formation-debug-V0.4.4.apk /data/local/tmp/net.abc.pqr
    $ adb shell pm install -t -r "/data/local/tmp/net.abc.pqr"
        pkg: /data/local/tmp/net.abc.pqr
    Success


    No apk changes detected since last installation, skipping installation of C:\User1\EspressoTest\app\build\outputs\apk\androidTest\formation\debug\app-formation-debug-androidTest.apk
    Running tests

    $ adb shell am instrument -w -r   -e debug false -e class 'net.abc.pqr.ui.TestScripts.test3' net.abc.pqr.test/android.support.test.runner.AndroidJUnitRunner
    Client not ready yet..
    Started running tests

    java.lang.NoClassDefFoundError: Failed resolution of: Ljava/beans/Introspector;
    at freemarker.ext.beans.ClassIntrospector.addBeanInfoToClassIntrospectionData(ClassIntrospector.java:306)
    at freemarker.ext.beans.ClassIntrospector.createClassIntrospectionData(ClassIntrospector.java:274)
    at freemarker.ext.beans.ClassIntrospector.get(ClassIntrospector.java:244)
    at freemarker.ext.beans.ClassBasedModelFactory.getInternal(ClassBasedModelFactory.java:99)
    at freemarker.ext.beans.ClassBasedModelFactory.get(ClassBasedModelFactory.java:47)
    at freemarker.ext.beans._EnumModels.get(_EnumModels.java:28)
    at com.relevantcodes.extentreports.HTMLReporter.start(HTMLReporter.java:80)
    at com.relevantcodes.extentreports.Report.attach(Report.java:318)
    at com.relevantcodes.extentreports.ExtentReports.<init>(ExtentReports.java:86)
    at com.relevantcodes.extentreports.ExtentReports.<init>(ExtentReports.java:375)
    at net.abc.pqr.ui.TestScripts.test3.test3(test3.java:53)
    at java.lang.reflect.Method.invoke(Native Method)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:527)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at android.support.test.runner.AndroidJUnit4.run(AndroidJUnit4.java:101)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
    at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
    at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:384)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1984)
    Caused by: java.lang.ClassNotFoundException: Didn't find class "java.beans.Introspector" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/net.abc.pqr.test-2/base.apk", zip file "/data/app/net.abc.pqr-2/base.apk"],nativeLibraryDirectories=[/data/app/net.abc.pqr.test-2/lib/arm, /data/app/net.abc.pqr-2/lib/arm, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 41 more
    Suppressed: java.lang.ClassNotFoundException: java.beans.Introspector
    at java.lang.Class.classForName(Native Method)
    at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
    at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
    ... 42 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

    Tests ran to completion.

0 ответов

Другие вопросы по тегам