我正在使用Serenity BDD(Selenium)在Chrome中运行自动化测试.
我不得不下载新的ChromeDriver,因为我的测试无法运行 - >测试会打开ChromeDriver,但无法"以用户身份浏览".当我搜索问题时,他们说我必须更新ChromeDriver.
所以我将ChromeDriver更新到版本2.28,我还将Chrome版本更新为版本57.0.2987.98.
但现在 - 每次我运行测试时都会出现这个烦人的文字:
Chrome由自动化测试软件控制
它问我是否要保存密码.(我无法添加图片,因为我没有足够的"积分")
在之前的版本中,我设法通过以下方式阻止这两件事:
public class CustomChromeDriver implements DriverSource {
@Override
public WebDriver newDriver() {
try {
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
Proxy proxy = new Proxy();
String proxyServer = String.format("AProxyIDontWantToDisplay", System.getenv("proxy.username"), System.getenv("proxy.password"));
proxy.setHttpProxy(proxyServer);
capabilities.setCapability("proxy", proxy);
ChromeOptions options = new ChromeOptions();
options.addArguments(Arrays.asList("--no-sandbox","--ignore-certificate-errors","--homepage=about:blank","--no-first-run"));
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);
return driver;
} catch (Exception e) {
throw new Error(e);
}
}
@Override
public boolean takesScreenshots() {
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
我知道有这个(相同问题的链接),但有太多的答案不起作用. …
java selenium google-chrome selenium-chromedriver serenity-bdd
Today I've got some theoretical question. I have a little experience in BDD with Cucumber. Now I started working in API testing and I faced with Serenity BDD framework on my new project. It is used with Cucumber. So I would like to clarify what is the difference between Serenity BDD Framework and Cucumber and why can't we use just Cucumber for our tests, because it seems to me, like these two tools are doing the same job. Could anybody …
需要你的帮助!
我一直致力于将我的自动化测试集成到 Jenkins。我使用 Serenity BDD 和 JBehave。当我手动运行测试时,我的 Serenity 报告显示正常。但是,当我将测试集成到 Jenkins 并尝试通过 Publish HTML Report Plugin 显示报告时,它无法显示饼图并且也缺少其他元素。
知道如何解决这个问题吗?
这些写在宁静执行输出中的笨重横幅让我很生气:
864 [main] INFO net.serenitybdd.core.Serenity -
_____ _____ ____ _____ ____ _____ _ ____ _____ _____ ____
|_ _| ____/ ___|_ _| / ___|_ _|/ \ | _ \_ _| ____| _ \
| | | _| \___ \ | | \___ \ | | / _ \ | |_) || | | _| | | | |
| | | |___ ___) || | ___) || |/ ___ \| _ < | | | |___| |_| |
|_| |_____|____/ …Run Code Online (Sandbox Code Playgroud) 我使用Serenity BDD在我的项目上进行测试自动化,将 IntelliJ IDEA 作为 IDE。我想更改每次运行测试时可以看到的日志的格式和调试级别。
例如,我只想查看[main]线程的日志:
[main] INFO net.thucydides.core.reports.junit.JUnitXMLOutcomeReport
[pool-3-thread-1] INFO net.thucydides.core.reports.ReportService -
Run Code Online (Sandbox Code Playgroud)
我知道如何进行 logback,但我找不到任何有关如何以及在何处更改 Serenity 日志设置的信息。
我试图在我的工作场所用Restassured来展示宁静,并告诉他们与使用jasmine.js相比,它是多么棒和容易使用我怎么会在基本测试中遇到一些问题我试图做我的测试说
Given we have valid credentials for the client using this test
When we try to serach for a medicine '<medicine>'
Then we get a valid '<perfLabel>' response with search results
|medicine|perflabel|
|Salbutamol|perflabel1|
|Panadol|perflabel2|
|Salbutamol (GA)|perflabel3|
Run Code Online (Sandbox Code Playgroud)
当我进入下一步
@When("we try to serach for a medicine '(.*)' ")
public void tryToSearchUsingEquals(String medicine)
{
tsApiActions.requestServiceSearchWhichEquals(medicine);
}
In my Step method
@Step
public void requestServiceSearchWhichEquals(String medicine)
{
host = "http://www.int.abc.com.au/api/cs/v1/terminology-service/trade-product/search-summary?offset=0&limit=20&prefLabel=eq "+medicine+"&sort=prefLabel DESC&cache=false";
requestSend(host);
}
Run Code Online (Sandbox Code Playgroud)
我的问题是
任何帮助非常感谢谢谢
我有一个类似于以下的小黄瓜场景:
Scenario Outline: Test some behaviour
Given a set of preconditions
When an event occurs
Then my application has to behave in a particular manner
And respond as expected
Run Code Online (Sandbox Code Playgroud)
当我执行这个场景时,我的报告说
0 个场景,执行 0 个步骤。
然而,当我使用示例执行场景时,我的设置工作正常。
我错过了什么吗?
我希望更改 Serenity 报告中的 CSS 和徽标。此外,我想在 Serenity 报告中添加一些自定义文本或指向某些测试的链接。就像生成了一个 excel 报告一样,我希望在报告的测试步骤中提供它的链接。实现这一目标的最佳方法是什么?
更新Firefox之后,我将库的版本更改为更高版本。出现以下错误:[错误] commons-collections:commons-collections:3.2.2的依赖项收敛错误路径为:
[ERROR] +-net:serenity.pom.gradle:0.0.1-SNAPSHOT
[ERROR] +-net.serenity-bdd:serenity-core:1.1.29-rc.3
[ERROR] +-org.seleniumhq.selenium:htmlunit-driver:2.20
[ERROR] +-commons-collections:commons-collections:3.2.2
[ERROR] and
[ERROR] +-net:serenity.pom.gradle:0.0.1-SNAPSHOT
[ERROR] +-net.serenity-bdd:serenity-core:1.1.29-rc.3
[ERROR] +-io.appium:java-client:3.3.0
[ERROR] +-commons-validator:commons-validator:1.4.1
[ERROR] +-commons-collections:commons-collections:3.2.1
[ERROR] and
[ERROR] +-net:serenity.pom.gradle:0.0.1-SNAPSHOT
[ERROR] +-net.serenity-bdd:serenity-core:1.1.29-rc.3
[ERROR] +-commons-collections:commons-collections:3.2.2
[ERROR] ]
[ERROR] -> [Help 1]
Run Code Online (Sandbox Code Playgroud)
依赖树如下所示:
[INFO] +- net.serenity-bdd:serenity-core:jar:1.1.29-rc.3:test
[INFO] | +- org.seleniumhq.selenium:htmlunit-driver:jar:2.20:test
[INFO] | +- commons-collections:commons-collections:jar:3.2.2:test
[INFO] | +- io.appium:java-client:jar:3.3.0:test
[INFO] | | \- commons-validator:commons-validator:jar:1.4.1:test
[INFO] | | +- commons-beanutils:commons-beanutils:jar:1.8.3:test
[INFO] | | \- commons-digester:commons-digester:jar:1.8.1:test
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题呢?我可以手动切换图书馆吗?
PS这是我的pom.xml
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>1.1.29-rc.3</version> …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Serenity 框架中使用 Rest Assured 来验证端点响应。我将一个 xml 正文发送到端点,并期望返回一个 JSON 响应,如下所示:
{"Entry ID" : "654123"}
Run Code Online (Sandbox Code Playgroud)
我想发送 XML 并在 JSON 响应中验证键“条目 ID”的值不为空或为空。问题是,密钥中有一个空格,我相信它会导致错误。这是我到目前为止所拥有的:
SerenityRest.given().contentType(ContentType.XML)
.body(xmlBody)
.when().accept(ContentType.JSON).post(endpoint)
.then().body("Entry ID", not(isEmptyOrNullString()))
.and().statusCode(200);
Run Code Online (Sandbox Code Playgroud)
这会产生错误:
java.lang.IllegalArgumentException: Invalid JSON expression:
Script1.groovy: 1: unable to resolve class Entry
@ line 1, column 33.
Entry ID
^
1 error
Run Code Online (Sandbox Code Playgroud)
我尝试以不同的方式包装“条目 ID”术语,但无济于事:
.body("'Entry ID'", not(isEmptyOrNullString()))
.body("''Entry ID''", not(isEmptyOrNullString()))
.body("\"Entry ID\"", not(isEmptyOrNullString()))
.body("['Entry ID']", not(isEmptyOrNullString()))
.body("$.['Entry ID']", not(isEmptyOrNullString()))
Run Code Online (Sandbox Code Playgroud)
是否可以在 Rest Assured 中获取包含空格的键的值?
我在youtube上观看了一个视频,建议使用剧本模式作为使用常用页面对象的替代方案.我看到的唯一优势是页面对象类没有那么大.还有其他我想念的东西吗?我一直在搜索,所有网站都在使用serenity bdd参考youtube讲座中的示例.有人可以解释为什么它比使用页面对象更好(或者更糟)?
一个不使用宁静bdd的例子真的很有帮助.
我有一个 gradle + Serenity + RestAssured 自动检查套件设置,我通常通过 shell 会话中的 gradle 命令运行,但有时我需要使用 IntelliJ 运行单个场景。
当我在 IntelliJ 上运行 Scenarios 时,我通常会收到很多这样的警告:
8312 [main] WARN cucumber.runtime.SerenityBackend - It looks like you are
running a feature using @RunWith(Cucumber.class)
instead of @RunWith(CucumberWithSerenity.class).
Are you sure this is what you meant to do?
Run Code Online (Sandbox Code Playgroud)
我想知道在何处以及如何在 IntelliJ 中配置运行/调试配置,以便运行检查并CucumberWithSerenity.class修复警告。
我正在使用以下依赖项:
serenity-rest-assured:1.9.31
serenity-core:1.9.31
serenity-cucumber:1.9.12
Run Code Online (Sandbox Code Playgroud)
IntelliJ版本2018.1.5(社区版)
之前/之后的场景在 jbehave serenity BDD serenity.version 1.2.3-rc.5 serenity.jbehave.version 1.21.0 中不起作用
例如
public class UploadDocumentWhatStep {
@BeforeScenario
public void beforeEachScenario(){
System.out.println("in before");
}
@Given("Sample Given")
public void cleanUp() {
System.out.println("in given");
}
@When("Sample When")
public void action() {
System.out.println("in When");
}
@Then("Sample Then")
public void action() {
System.out.println("in then");
}
@AfterScenario
public void afterEachScenario(){
System.out.println("in After");
}
}
Run Code Online (Sandbox Code Playgroud)
当我尝试运行此代码时,输出是
Output:
in given
in When
in Then
Run Code Online (Sandbox Code Playgroud) serenity-bdd ×13
java ×5
cucumber ×4
jbehave ×2
rest ×2
selenium ×2
thucydides ×2
jenkins ×1
json ×1
log4j ×1
logging ×1
maven ×1
maven-3 ×1
pageobjects ×1
report ×1
rest-assured ×1