小编nik*_*kar的帖子

使用java获取黄瓜中未定义的场景和步骤

两天以来我一直在与这个作斗争。我的测试显示已通过,但测试未在 cucumber+java 中运行 Selenium webdriver 测试。在控制台中我收到以下消息

1 Scenarios (1 undefined)
4 Steps (4 undefined)
0m0.000s


You can implement missing steps with the snippets below:

@Given("^User navigate to shopping page$")
public void user_navigate_to_shopping_page() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@When("^user enters data$")
public void user_enters_data() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@When("^clicks on search button$") …
Run Code Online (Sandbox Code Playgroud)

java junit selenium cucumber

4
推荐指数
1
解决办法
3万
查看次数

Java Stream - maxBy - 如何使用 Java 8 查找平均工资最高的部门

我有一份清单Employee

public class Employee {
    private String department;
    private double salary;
    // other properties
}
Run Code Online (Sandbox Code Playgroud)

我正在尝试查找平均工资最高的部门的名称。

我尝试过的代码:

List<Employee> employeeList = new ArrayList<Employee>();
employeeList.add(new Employee("abc", 38, "M", "QA", 115000.00d, 2016));
employeeList.add(new Employee("def", 23, "M", "Sports", 5000000.00d, 2011));
employeeList.add(new Employee("ghi", 38, "M", "QA", 120000.00d, 2007));
employeeList.add(new Employee("jkl", 35, "M", "DEV", 50000.00d, 2016));
employeeList.add(new Employee("mno", 30, "F", "QA", 80000.00d, 206));
employeeList.add(new Employee("pqr", 32, "F", "DEV", 75000.00d, 2014));

Map<String, Double> highestAvgSalary = employeeList.stream()
    .collect(Collectors.groupingBy(
        emp -> emp.getDepartment(),
        Collectors.averagingDouble(emp -> emp.getSalary(),                        
            Collectors.maxBy(Comparator.comparingDouble(emp -> …
Run Code Online (Sandbox Code Playgroud)

java java-stream collectors

1
推荐指数
1
解决办法
960
查看次数

Cypress:有什么方法可以用测试用例中生成的数据替换固定字段以生成动态有效负载(尝试了现有的 sol)

我是赛普拉斯的新手。我想知道是否有任何方法可以通过用 cypress 测试中以编程方式生成的值替换 JSON 文件的值来生成动态有效负载。我们在放心中所做的事情是替换 JSON 文件的 %s。我在网上搜索了很多但没有找到。类似的一些问题是这对我不起作用 我想将动态 json 正文传递给 cypress request() 函数并定义有效负载值

我有以下 json 文件

{
    "name": "Ganesh vishal kumar",
    "gender": "Male",
    "email": "ganesh.kumar234@test.org",
    "status": "active"
}
Run Code Online (Sandbox Code Playgroud)

我想要一个动态 JSON 文件装置。在下面的测试中,我以编程方式生成电子邮件 ID 并直接在 JSON 正文中使用它。这里我想使用JSON文件fixture

it('first post test', () => {
        var pattern = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
        var emailId = "";

        for (var x = 0; x < 10; x++) {
            emailId = emailId + pattern.charAt(Math.floor(Math.random() * pattern.length));
        }
        emailId = emailId + '@test.org'
        cy.request({
            method: 'POST',
            url: 'https://gorest.co.in/public/v2/users',
            body: { …
Run Code Online (Sandbox Code Playgroud)

json typescript web-api-testing cypress

-2
推荐指数
1
解决办法
347
查看次数