我的团队正在研究依赖注入框架,并试图决定使用Google-Guice和PicoContainer.
我们正在寻找框架中的几件事:
将非常感谢两个框架与所列标准的比较.任何有助于比较两者的个人经历也会非常有帮助.
免责声明:我对依赖注入相当新,如果我问一个与本次讨论无关的问题,请原谅我的新闻.
我正在开发一个 Web 测试自动化框架,并且希望通过另一个describe()cypress ..spec.js文件中存在的方法,在一个 cypress ..spec.js 文件中的块中提供一些功能?
请阅读Mocha 中提供的
共享行为工具: https://github.com/mochajs/mocha/wiki/Shared-Behaviours

我尝试过,但它不起作用。1.是否可以实现类似于Mocha Shared步骤的东西(如上所述)?2.或者有类似Cucumber-ruby/Pico-container的WORLD对象的东西吗?
好心提醒。
我目前正在使用Cucumber,JUnit和Selenium开发Java测试框架。我已经从事过类似的项目,但是在这个项目上遇到了问题。
我正在尝试创建一个Singleton的Context类。我想使用Cucumber-picocontainer在每个步骤定义类中都可以访问此类。我在pom.xml中添加了依赖项,但是每次尝试执行测试时,都会有一个异常消息:“ NewLoginSteps没有空的构造函数。如果您需要DI,则在类路径上放置cumul-picocontainer” 。我尝试手动导入罐子,但没有帮助。
这是我的配置示例:
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<cucumber.version>1.2.4</cucumber.version>
<selenium-java.version>2.39.0</selenium-java.version>
</properties>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</project>
Run Code Online (Sandbox Code Playgroud)TestContext.java:
public class TestContext {
private static Map<String, String> siteLocations = new HashMap<String, String>();
private static boolean initialized = false;
private static boolean firstInitDone = false;
private static WebDriver driver;
private static boolean testsToRun = …Run Code Online (Sandbox Code Playgroud) 我正在运行Cucumber JVM功能文件,使用Java8和PicoContainer.我已经剥离了这些步骤,因此它们是空的,我仍然会收到错误.这是我的功能:
Feature: Full Journey
Scenario: Can load a typical JIRA csv and calculate the distribution from it
Given a typical JIRA export "/closed_only_JIRA.csv"
When I import it into Montecarluni
Then I should see the distribution
"""
6, 15, 3, 14, 2, 5, 6, 8, 5, 10, 15, 4, 2, 1
"""
When I copy it to the clipboard
Then I should be able to paste it somewhere else
Run Code Online (Sandbox Code Playgroud)
(是的,这是一个完整的旅程而不是BDD方案.)
无论出于何种原因,在Kotlin中运行此步骤会导致错误:
import cucumber.api.java8.En
class ClipboardSteps(val world : World) : En …Run Code Online (Sandbox Code Playgroud) 我想用JobEnabledDecorator对象包装许多实现Job接口的类,该对象确定它是否执行.
我无法弄清楚如何在PicoContainer中配置它,以便它知道用JobEnabledDecorator包装它们来创建Job实现对象.
这在依赖注入框架中是否可行?
PicoContainer有可能吗?
如果是这样,任何帮助将不胜感激.
java dependency-injection decorator inversion-of-control picocontainer
在我的情况下,我很难理解和利用依赖注入。我想使用 Pico-container ( https://cucumber.io/blog/2015/07/08/polymorphic-step-definitions )。
这是我的情况......我目前有一个包含我所有 selenium 的 step 定义类,并且它变得太大了:
public class StepDefinitions{
public static WebDriver driver; // a driver is returned here from a static Driver Factory Class
LoginPage loginPage = new LoginPage(driver); //Page Object Model(s)
@Before("setup")
@After //screen snapshot
@After("destroy")
@Given //many methods with this tag
@When //many methods with this tag
@Then //many methods with this tag
}
Run Code Online (Sandbox Code Playgroud)
现在我想可能有一个包含我的驱动程序、POM 和 Hooks 的类:
public static WebDriver driver; //driver is returned from a static Driver Factory Class
LoginPage loginPage …Run Code Online (Sandbox Code Playgroud)