gpt4 book ai didi

eclipse - 我们可以直接从 eclipse 执行 Hybris 集成测试用例吗?

转载 作者:行者123 更新时间:2023-12-02 11:25:24 28 4
gpt4 key购买 nike

我能够使用“ant alltests”命令从 hybris 平台目录执行测试用例,但不能从 eclipse 执行测试用例。

从 eclipse 执行测试用例时出现以下错误 -> 右键单击​​ -> 运行为 -> JUnit 测试

INFO  [main] (junit) [HybrisContextFactory] - Refreshing SpringContext (hybris Application context - junit) took: (29.48 s)
INFO [main] (junit) [HybrisContextFactory] Initializing application Spring ApplicationContext for tenant junit took: (31.27 s)
INFO [main] (junit) [DefaultRMIRegistryService] Unexporting the registry.
de.hybris.platform.core.UninstantiableCoreApplicationContextException: Error creating Spring application context.
at de.hybris.platform.core.AbstractTenant.doStartupSafe(AbstractTenant.java:728)
at de.hybris.platform.core.AbstractTenant.doStartUp(AbstractTenant.java:658)
at de.hybris.platform.core.Registry.assureTenantStarted(Registry.java:639)
at de.hybris.platform.core.Registry.activateTenant(Registry.java:700)
at de.hybris.platform.core.Registry.setCurrentTenant(Registry.java:544)
at de.hybris.platform.util.Utilities.setJUnitTenant(Utilities.java:1472)
at de.hybris.platform.testframework.runlistener.PlatformRunListener.testRunStarted(PlatformRunListener.java:44)
at de.hybris.platform.testframework.ChainingRunNotifierWrapper$1.notifyListener(ChainingRunNotifierWrapper.java:97)
at de.hybris.platform.testframework.ChainingRunNotifierWrapper$SafeNotifier.run(ChainingRunNotifierWrapper.java:239)
at de.hybris.platform.testframework.ChainingRunNotifierWrapper.fireTestRunStarted(ChainingRunNotifierWrapper.java:99)
at de.hybris.platform.testframework.HybrisJUnit4ClassRunner.run(HybrisJUnit4ClassRunner.java:124)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name

最佳答案

是的,这是可能的。

实际上,使用 hybris 6.1 和 Eclispe Neon,我能够从 hybris 项目运行 Junit 测试,而不会出现任何 GUI 问题。

要使 Eclispe 中的测试正常工作,您必须确保

  • 您的所有项目都已在 Eclipse 中正确配置(没有错误)
  • 所有依赖项都存在于您的工作区中
  • localextensions.xml 文件的所有配置扩展均在 Eclipse JUnit 测试配置的类路径中注册。

要修复最后一点,请执行以下步骤

  • 打开运行菜单
  • 打开运行配置对话框
  • 运行配置对话框中,选择您的测试配置
  • 转到类路径选项卡。
  • 点击添加项目按钮。
  • 在“项目选择”对话框中,选择您在 localextensions.xml 文件中配置的所有扩展。

来自 hybris 的其他提示

If your Spring configuration does not get bootstrapped at the startup of the Hybris Platform, the Spring file is probably not a part of test classpath. This can either be caused by a missing project at the classpath, or by not including your resources folder in the Eclipse classpath at all. Assure that your .classpath file contains the following line: <classpathentry exported="true" kind="lib" path="resources"/>

<小时/>

关于您的具体问题

如果能发布 MCVE 就太好了因为这个问题可能与您的具体测试有关。以上提示可以帮助您。在尝试自己的测试之前,请先尝试从 hybris 成功运行测试。

<小时/>

资源和进一步阅读

Testing in SAP Hybris Commerce - 检查Eclipse部分

Eclipse workspace errors - A Complete guide - 包含更多资源来解决 Eclipse 中的错误

The Hybris Testweb Frontend - 如果您想从此界面测试您的测试,请考虑初始化 junit tenant之前

关于eclipse - 我们可以直接从 eclipse 执行 Hybris 集成测试用例吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40256997/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com