- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 eclipse 中使用 maven 有一个 Jbehave 和 selenium 项目。最初我是为一个故事做的,但现在我写了两个故事,我希望这两个故事在测试中运行。但只有一个故事文件通过程序。我如何找到资源文件夹中的所有故事文件?
这是我到目前为止的代码谷歌.java
public class Google extends JUnitStory {
@Override
public Configuration configuration(){
return new MostUsefulConfiguration().useStoryLoader(
new LoadFromClasspath(this.getClass()))
.useStoryReporterBuilder(
new StoryReporterBuilder().withCodeLocation(
CodeLocations.codeLocationFromClass(this
.getClass())).withFormats(
Format.CONSOLE, Format.TXT, Format.HTML, Format.STATS))
;
}
@Override
public List<CandidateSteps> candidateSteps(){
return new InstanceStepsFactory(configuration(),
new GoogleStep()) //can put in a comma separated list of Step implementers here
.createCandidateSteps();
}
protected List<String> storyPaths(){
return new StoryFinder().findPaths(
CodeLocations.codeLocationFromClass(this.getClass()),
"*.story", "");
GoogleStep.java
public class GoogleStep {
private WebDriver driver;
private FluentWait<WebDriver> fWait;
public GoogleStep() {
System.setProperty("webdriver.gecko.driver","C:\\Program Files\\GeckoDriver\\geckodriver.exe");
File pathToBinary = new File("C:\\Program Files\\Mozilla Firefox\\firefox.exe");
FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary);
FirefoxOptions options = new FirefoxOptions();
options.setCapability("moz:firefoxOptions", options.setBinary(ffBinary));
WebDriver driver2 = new FirefoxDriver(options);
driver = driver2;
fWait = new FluentWait<WebDriver>(driver).pollingEvery(500,
TimeUnit.MILLISECONDS).withTimeout(10, TimeUnit.SECONDS);
}
//Google Mapping
@Given("I navigate to google.lk")
public void navigateToGoogle(){
driver.get("https://www.google.lk/");
fWait.until(ExpectedConditions.visibilityOfElementLocated(By.id("lst-ib")));
}
@When("I perform a google search for $query")
public void performASearchForGoogleQuery(String query){
driver.findElement(By.id("lst-ib")).sendKeys(query);
}
@Then("I click google Search Button")
public void clickSearchGoogleButton() {
driver.findElement(By.xpath("//input[@value='Google Search']")).click();
}
@Then("A google link $text exists in the results")
public void linkContainingTextExistsInTheGoogleResults(String resultText){
driver.getPageSource().contains(resultText);
}
//yahoo mapping
@Given("I navigate to yahoo.com")
public void navigateToYahoo(){
driver.get("https://www.yahoo.com/");
fWait.until(ExpectedConditions.visibilityOfElementLocated(By.id("uh-search-box")));
}
@When("I perform a yahoo search for $query")
public void performASearchForYahooQuery(String query){
driver.findElement(By.id("uh-search-box")).sendKeys(query);
}
@Then("I click yahoo Search Button")
public void clickSearchYahooButton() {
driver.findElement(By.xpath("//*[@id='uh-search-button']")).click();
}
@Then("A yahoo link $text exists in the results")
public void linkContainingTextExistsInTheYahooResults(String resultText){
driver.getPageSource().contains(resultText);
}
我有两个故事文件,分别命名为 google.story 和 yahoo.story
我的文件夹结构如下
我在这里做错了什么或者我必须做什么?任何帮助都会非常有帮助。
最佳答案
我是这样做的:
@Override
protected List<String> storyPaths() {
URL searchLoc = CodeLocations.codeLocationFromClass(this.getClass());
return new StoryFinder().findPaths(searchLoc, Arrays.asList("**/google.story",
"**/yahoo.story",
""),
Arrays.asList("**/excluded*.story"));
}
第一个数组列表中的额外元素可能不是必需的,但我将其包含在内,因为我最初从中获取信息的示例就是这样做的,但我可以通过这种方式添加多个故事,只需为每个新故事添加更多元素故事,如果我只想运行一个故事,我可以在每个我不想运行的故事之前加上注释双斜杠(//),即
return new StoryFinder().findPaths(searchLoc, Arrays.asList("**/google.story",
//"**/yahoo.story",
""),
Arrays.asList("**/excluded*.story"));
只会运行 google.story。
关于java - Jbehave 无法找到多个故事,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52718255/
我要在这里做的是遍历Storybook故事,以便可以对它们进行视觉回归测试: const puppeteer = require('puppeteer'); const { toMatchImageS
有人可以帮我解释一下涉及老虎机的 Rasa 故事吗: ## story with email * intent_request_email - utter_request_email * in
我们能够实现与 Instagram Stories 的共享,但无法实现与 Facebook Stories 的共享,如下 these指示 。尽管已安装并更新 Facebook 应用,Android 仍
我在使用 Facebook 开放图表故事时遇到问题。我只想发布一个带有对象标题的故事。我尝试使用开放图形对象调试器,我可以清楚地看到 og:title 已定义,但我发布的提要中没有标题。 我也尝试使用
如何将数据从 .properties 文件动态加载到 jBehave 故事文件?我一直在我的故事文件中使用 $ ,例如: When the stock is traded at price : $ T
我是 jbehave 的新手 我正在尝试通过 junit 执行 jbehave。 jbehave 似乎只从类路径加载故事文件。是否可以将其配置为从用户定义的路径中获取故事文件。 public clas
我们刚刚开始考虑使用 JBehave 进行验收测试,我想知道使用它的人是如何组织故事的编写和故事文件的存储的。目前只是在开发它们,所以我们将故事文件与实现它们的 Java 代码一起存储在资源文件夹中。
我正在尝试按顺序运行 jbehave 故事。 我的集成测试包结构如下所示 src/it/some/package/name/packageA/a.story src/it/some/package/n
我有一个 jBehave 故事如下; Scenario: Setup test GivenStories: common/story_1.story, common/sto
有人可以帮我运行一个 JBehave 故事吗?我在 Eclipse 中有一个 Maven 项目。 故事是: Meta: @author Nikolay Vasilev @bdd-talk: BG JU
我们有一个 Web 开发项目团队,我们决定使用单个存储库及其优缺点。我们将待办事项分成 Jira 故事,每个故事都有几个 FE 和 BE 任务。喜欢: ABC-1 显示猫 1.1. ABC-2 [FE
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
在我们公司,我们目前正在尝试建立故事 map (Jeff Patton)的概念。 我有以下问题:- 在具有交叉问题/任务的故事 map 中会发生什么?我们有贯穿整个项目的事件。故事 map 中的这些事
我想获得与远程 GIT 和 SVN 存储库同步的本地 GIT 存储库。 我正在执行的步骤如下: > git push Everything up-to-date > git pull Already
目前我所有的 .stories 文件都保存在 stories 目录中。随着我添加更多组件,它会增长。 相反,我想根据 Storybook 站点上的文档在组件级别添加每个组件的 .stories 文件:
我在网上读到 snapchat 和 instagram 有不同的方法来捕获视频,而不是在 Android 中使用相机 API,这允许它们向捕获的内容添加过滤器/贴纸等。 任何人都可以建议解决这个问题的
在 let returnTrip = Page(story: .ReturnTrip) 中它给了我们错误。我真的不知道为什么1 enum Story { case ReturnTrip (String
我们刚刚开始将Jira(带有Jira Agile插件-Scrum模板)用于我们的问题跟踪程序和敏捷计划。 我对故事和改进之间的差异(或预期的差异)感到困惑。我们所有的“东西”都写成故事。这些故事描述了
我正在为一个网站设计一个数据库,该数据库将至少表示 4 种不同的对象类型(文章、博客文章、照片、故事),每一种都有足够不同的数据要求来保证他们自己的表。我们希望用户能够发表任何这些类型的评论。评论的数
就目前情况而言,这个问题不太适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、民意调查或扩展讨论。如果您觉得这个问题可以改进并可能重新开放,visit
我是一名优秀的程序员,十分优秀!