【问题标题】:Google App Engine Objectify integration testsGoogle App Engine Objectify 集成测试
【发布时间】:2014-03-01 20:52:36
【问题描述】:

我有一些 junit 测试可以很好地与 objectify 一起运行。 我来了

  • GAE 1.8.8
  • maven 3.1.1
  • failsafe-maven-plugin 2.4.3-alpha-1
  • jdk 1.7
  • jetty-maven-plugin 8.0.1.v20110908

为了实现本地持久性模拟,我通常有这样的设置:

@ContextConfiguration(value = "classpath*:/test-config.xml")
@RunWith(SpringJUnit4ClassRunner.class)
public class PassengerServiceTest {
    private static final Logger log = Logger.getLogger(PassengerServiceTest.class);
    private final LocalServiceTestHelper helper = new LocalServiceTestHelper( new  LocalDatastoreServiceTestConfig());

    @Before
    public void setup() {
      helper.setUp();
    }

    @After
    public void tearDown() {
      helper.tearDown();
    }
}

但是,当我使用 maven-failsafe-plugin 对码头运行一些集成测试时,我看到以下错误:

com.googlecode.objectify.SaveException:保存乘客时出错{id=139, email='will@email.com', firstName='will'}:没有 API 环境注册了这个话题。

现在集成测试类似于上面的单元测试,只要我设置了 LocalServiceTestHelper

我一直在想,在预集成测试阶段构建并部署在码头内的 war 文件不再了解 LocalServiceTestHelper。

任何想法如何使用 maven-failsafe-plugin 为集成测试解决这个问题?

【问题讨论】:

  • 你能显示你的 pom 文件吗?
  • 我在尝试使用 jBehave 测试 Google App Engine 代码时遇到了相同的 SaveException。我在LocalServiceTestHelper 上给setUp() 打电话,并在ObjectifyService.register() 上注册了我的班级。

标签: google-app-engine maven junit jetty objectify


【解决方案1】:

你考虑过maven-failsafe-plugin的命名约定吗:

这意味着你的集成应该被命名为 WhatEverIT.java ..

   <includes>
     <include>**/IT*.java</include>
     <include>**/*IT.java</include>
     <include>**/*ITCase.java</include>
   </includes>

【讨论】:

  • 是的,已经到位。
猜你喜欢
  • 2014-03-12
  • 1970-01-01
  • 2011-06-19
  • 2014-08-09
  • 2012-05-05
  • 2012-03-04
  • 2012-10-13
  • 1970-01-01
  • 2016-03-25
相关资源
最近更新 更多