简体   繁体   English

在 Extents Report 的 test.log() 中统计项目并打印

[英]Count items and print in Extents Report's test.log ()

I cannot print a variable of type INT in the test.log () of the extents report and I need this information.我无法在范围报告的 test.log () 中打印 INT 类型的变量,我需要此信息。

@Test
    public void CT02_ContandoCategorias() {

        Response response = given().contentType("application/json").get(urlBase);
        test.log(LogStatus.INFO, "Chamando a Api", urlBase);

        List<String> QuantidadeCategorias = response.jsonPath().getList("$");    
    
        test.log(LogStatus.PASS, "Retorno", response.jsonPath().getString("$").length());

    }

I want you to print the number of items in the Report, but you are printing the name of the items.我希望您打印报告中的项目数,但您正在打印项目的名称。

计数

In this case you likely want to use.length without parentheses to get the number of elements in the array and not.lenght() to get the number of characters in the String.在这种情况下,您可能希望使用不带括号的 .length 来获取数组中的元素数,而不是使用 not.lenght() 来获取字符串中的字符数。

See https://www.geeksforgeeks.org/length-vs-length-java/https://www.geeksforgeeks.org/length-vs-length-java/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.io.FileNotFoundException: /target/test.log - java.io.FileNotFoundException: /target/test.log Java进程执行“ tail -f test.log | grep abc”无法获得任何输出 - Java process execute “tail -f test.log | grep abc” can't not get any output Log4j - 在日志文件中打印测试用例名称 - Log4j - Print test case name in log file 如何使用TestNG在报告中记录自定义跳过的测试方法详细信息? - How to log the custom skipped test method details in report using TestNG? 使用 Java Streams 计算并打印一个链中的唯一列表项 - Count and print unique list items in one chain using Java Streams 打印多个数组项的单个计数值 - Print out a Single count value for multiple Array items 如何用颜色强制蚂蚁打印junit的报告 - How to force ant print junit's report with colour Java log4j的日志消息的最大长度是多少?如何在一行中打印? - What is the length of Java log4j's log message's max length? How to print it in a single line? 使用递归计算数字中的总位数,当 n 为 0 时,计算它并打印 1。我的问题是如何将 0 计为数字并打印 1? - Count Total Digits in a Number useing recursion and when n is 0 then count it's and print 1 . and my question is how to count 0 as digits and print 1? 如何用Java打印报告? - How to print a report in Java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM