预填充 Selenium 测试数据库的常用方法有哪些?
如果我有一个测试需要X个小部件作为前提,我希望避免通过前端在测试中制作X个小部件的繁琐过程。主要的替代方案似乎是为每次测试运行加载一个指定的数据库转储,保证预定的状态(转储文件是通过手动执行前提条件然后转储结果模式生成的),或者使用 ORM 。
鉴于我们所有的业务逻辑都位于应用程序层,使用 ORM(Hibernate)复制它已被证明是很笨拙的。我的 Selenium 框架是 Java 语言,应用程序是使用 symfony 的 PHP 语言。
有哪些选择?有很长的测试,以某种方式从 Java 调用 symfony/PHP 命令,或者在存储库中难以维护转储文件?我应该在预设数据库上使用事务吗?优化测试运行时间和编写/维护简单性之间的权衡是关键。我一直在寻找像 DbUnit 这样的工具,也许可以提供帮助。
If I have a test that requires X widgets as a precondition, I'd like to avoid the tedious process of making X widgets in the test through the front-end. The main alternatives appear to be either having a stated DB dump that is loaded for each test run, guaranteeing a pre-determined state (the dump file is generated by doing the preconditions manually and then dumping the resulting schema), or by using an ORM.
Given that all of our business logic sits at the application layer, replicating it with an ORM (Hibernate) has proven to be unwieldy. My Selenium framework is in Java, the app is in PHP using symfony.
What are the options? Have really long tests, somehow call symfony/PHP commands from Java, or have a difficult to maintain dump file in the repo? Should I be using transactions instead on a preset DB? It is key to optimize the trade off of test run-time and writing/maintenance simplicity. I've been looking at tools like DbUnit to perhaps help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论