testing 相关问题

软件测试是旨在评估程序或系统的属性或功能并确定其满足其所需结果的任何活动。

Android Studio -> 测试通过:0 通过

我正在学习本教程,以刷新我的记忆并通过最新的“使用 Kotlin 开发 Android 应用程序”更新我的知识。 https://classroom.udacity.com/courses/ud9012 上课...

回答 1 投票 0

Cypress:在父元素中选择子元素,而无需不断地重新选择父元素

我有以下代码可以选择父元素的子元素: cy.get('form[data-cy="user_add"]').find('[name="username"]').type('test'); 这按原样工作正常,但是......

回答 1 投票 0

如何在 flutter 中测试动画?

我没有找到任何信息,但是查看flutter代码我认为它与AnimationSheetBuilder一起进行了黄金测试。 这是正确的方法吗?或者还有其他方法来测试动画吗? 比...

回答 1 投票 0

如何在我们的React Native expo应用程序中添加Admob,其expo版本是50和51

我的package.json是 { “名称”:“admob”, “版本”:“1.0.0”, "main": "expo/AppEntry.js", “脚本”:{ “开始”...

回答 1 投票 0

解决 Selenium 自动化设置中的 WebDriver 二进制文件更新问题

在我的 Selenium 自动化设置的repositorymap.xml 文件中指定的 ChromeDriver 二进制文件遇到兼容性问题。尽管尝试更新 和 <...

回答 1 投票 0

React Native Jest 测试超时问题

我的测试文件; 从'@testing-library/react-hooks'导入{renderHook,act}; 从 '../useInternetConnectivity' 导入 useInternetConnectivity; 从'@react-native-community/netinfo导入NetInfo...

回答 1 投票 0

GetByRole 在反应测试库中返回一些元素

给定匹配多个元素的 getByRole 选择器。它会返回什么? https://testing-library.com/docs/queries/byrole/ getByRole('按钮') 给定匹配多个元素的 getByRole 选择器。它会返回什么? https://testing-library.com/docs/queries/byrole/ getByRole('button') <body> <main> <button>Open dialog</button> </main> <div role="dialog"> <button>Close dialog</button> </div> </body> 会返回什么? 元素很少,有匹配的元素还是抛出错误? https://testing-library.com/docs/queries/byrole/ 根据文档, getBy 方法“返回查询的匹配节点,如果没有元素匹配或如果找到多个匹配项,则抛出描述性错误”

回答 1 投票 0

GetByRole 在反应测试中返回一些元素

给定匹配多个元素的 getByRole 选择器。它会返回什么? https://testing-library.com/docs/queries/byrole/ getByRole('按钮') 给定匹配多个元素的 getByRole 选择器。它会返回什么? https://testing-library.com/docs/queries/byrole/ getByRole('button') <body> <main> <button>Open dialog</button> </main> <div role="dialog"> <button>Close dialog</button> </div> </body> 会返回什么? 元素很少,有匹配的元素还是抛出错误? https://testing-library.com/docs/queries/byrole/ BCBGeneration g cng kuch nc nc

回答 1 投票 0

去测试 - Junit 结果

我的问题是我想从 Go 测试中获取 Junit 报告。问题是这本身是不可能的。我找到了几个可以做到这一点的工具,但出现了一个问题。 我找到了 go-j...

回答 2 投票 0

我正在我的 Vite React 应用程序中设置测试,但出现以下错误

无法从 C:\Users\ZN\Documents\dipish\React ite-project ite.config.js 加载配置 ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯未处理的错误⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ ⎯...

回答 1 投票 0

如何在 Cobra 测试中以编程方式设置标志?

我正在使用 cobra 构建 CLI,并希望模拟使用不同的选项/标志集运行的命令。我一直在尝试弄清楚如何使用 cobra API 在我的测试中设置标志...

回答 1 投票 0

Spring Cloud Stream 测试可轮询供应商

我的代码如下: 公共类 MyMessagesSupplier 实现供应商>> { @覆盖 @PollableBean 公共通量 我的代码如下: public class MyMessagesSupplier implements Supplier<Flux<Message<String>>> { @Override @PollableBean public Flux<Message<String>> get() { return Flux.just(MessageBuilder.createMessage("My message", new MessageHeaders(Map.of()))); } } 我有一个相应的云配置来触发这个bean,例如: spring.cloud.stream.bindings.myMessagesSupplier-out-0.procuder.poller.fixed-delay=60000 我想知道是否有一种方法可以通过 org.springframework.cloud:spring-cloud-stream-test-binder 或任何触发调度程序的方法来测试它,以便我可以对生成到 myMessagesSupplier-out-0 通道的消息进行断言。请帮忙! 这对我有用: 应用: @SpringBootApplication public class So78484341Application { public static void main(String[] args) { SpringApplication.run(So78484341Application.class, args); } @PollableBean public Supplier<Flux<Message<String>>> supplier() { return () -> Flux.just(MessageBuilder.createMessage("My message", new MessageHeaders(Map.of()))); } } 测试: @SpringBootTest @Import(TestChannelBinderConfiguration.class) class So78484341ApplicationTests { @Autowired private OutputDestination outputDestination; @Test void contextLoads() { Message<byte[]> receive = outputDestination.receive(5000, "supplier-out-0"); assertThat(new String(receive.getPayload(), StandardCharsets.UTF_8)).isEqualTo("My message"); } } 如果您想以受控方式测试供应商,您可以将绑定上的 auto-startup 设置为 false: spring.cloud.stream.bindings.supplier-out-0.producer.auto-startup=false 然后在测试中: @SpringBootTest @Import(TestChannelBinderConfiguration.class) class So78484341ApplicationTests { @Autowired private OutputDestination outputDestination; @Autowired private BindingsLifecycleController controller; @Test void contextLoads() { List<Binding<?>> bindings = controller.queryState("supplier-out-0"); Binding<?> binding = bindings.get(0); if (!binding.isRunning()) { binding.start(); } Message<byte[]> receive = outputDestination.receive(5000, "supplier-out-0"); assertThat(new String(receive.getPayload(), StandardCharsets.UTF_8)).isEqualTo("My message"); } }

回答 1 投票 0

@pytest.mark.parametrize 用于返回两个值的函数

我有一个函数,它接受 pandas DataFrame(重要的是,这个特定的 DataFrame 作为函数的参数,没有列名称)并生成一个带有列的 DataFrame ...

回答 1 投票 0

测试又测试不测试

小型初创公司可以成长为大型企业:Discord、Epic Games 和 Tesla 都是价值数十亿美元的公司,都是在云中起步的。 Peerobyte 基础设施非常适合具有规模的初创公司...

回答 1 投票 0

使用 Karate 为包含 DAO 的 API 构建组件测试?

我正在学习使用 Karate 为基于 Java 的 API 开发自动化测试,该 API 包含一个 DAO 层,用于与数据库通信以检索一些信息并将其呈现给被调用者。这是...

回答 1 投票 0

漂亮地打印为什么两个对象不相等

使用 pytest 时,当两个对象不等价时,我会得到漂亮的打印结果: 预期:Foo(id='red', other_thing='green') 实际:Foo(id='red', other_thing='blue') 使用 pytest 时,当两个对象不等价时,我会得到漂亮漂亮的打印: Expected :Foo(id='red', other_thing='green') Actual :Foo(id='red', other_thing='blue') <Click to see difference> def test_baz(): oneFoo = Foo(id="red", other_thing="blue") twoFoo = Foo(id="red", other_thing="green") > assert oneFoo == twoFoo E AssertionError: assert Foo(id='red', other_thing='blue') == Foo(id='red', other_thing='green') E E Full diff: E - Foo(id='red', other_thing='green') E ? ^^ -- E + Foo(id='red', other_thing='blue') E ? ^^^ baz.py:22: AssertionError 如果我直接在代码中使用断言,我只会得到一个 AssertionError 和一个堆栈跟踪。 我现在正在编写一些集成测试,这些测试不是由 pytest 驱动的,但希望在两个项目(特别是 Pydantic 数据类)不相等时进行漂亮的打印。 平等应该使用__eq__来实现: 例如: class Foo: def __init__(self, x, y): self.x = x self.y = y def __eq__(self, other): if isinstance(other, Foo): return self.x == other.x and self.y == other.y return False def __hash__(self): return hash((self.x, self.y)) a = Foo(1, 2) b = Foo(1, 2) c = Foo(3, 4) print(a == b) print(a == c) my_dict = {a: 'value 1', c: 'value 3'} print(my_dict[a]) 打印: True False value 1 注意 在这种情况下不需要 hash()。但实施这一点是一个很好的做法。 def __hash__(self): return hash((self.x, self.y)) 实际上,在您的代码中,这些对象并不相等,因此出现 AssertionError。如果您想用任何东西、您自己的自定义错误或其他任何东西重写它,那么您必须将其添加到您的 eq 方法中。 class Foo: def __init__(self, id, other_thing): self.id = id self.other_thing = other_thing def __eq__(self, other): if isinstance(other, Foo): return self.id == other.id and self.other_thing == other.other_thing return False def test_baz(): oneFoo = Foo(id="red", other_thing="blue") twoFoo = Foo(id="red", other_thing="green") try: assert oneFoo == twoFoo except AssertionError: raise ValueError(f"{oneFoo.__dict__} and {twoFoo.__dict__} are not equal.") test_baz() 打印 raise ValueError(f"{oneFoo.__dict__} and {twoFoo.__dict__} are not equal.") ValueError: {'id': 'red', 'other_thing': 'blue'} and {'id': 'red', 'other_thing': 'green'} are not equal.

回答 1 投票 0

在 Citrus Kafka Endpoint 中接收消息时将 AVRO 负载转换为 JSON

我正在做一个 PoC 来验证是否可以使用 Citrus 框架进行自动化测试,这需要检查 Kafka 主题中是否已发布一些数据。 对于演示,我使用 Kotlin,我也使用

回答 1 投票 0

在 Robot Framework 中检查多种文件类型的最佳方法

使用机器人框架进行自动化测试,以检查某些文件类型是否存在。 到目前为止,我们只检查 .crt 文件,但我现在需要检查 .crt 或 .pem 文件...

回答 2 投票 0

分支覆盖率与决策覆盖率相同吗?

我现在正在学习软件测试,我发现那里有很多覆盖标准。有件事让我很困惑。 分支覆盖率等于决策覆盖率吗? 维基百科说的...

回答 1 投票 0

条件覆盖率与决策覆盖率测试

条件覆盖率和决策覆盖率有什么区别? 我有一个简单的例子: 如果(A && B)那么 条件覆盖将有两个测试(结果将为 FALSE): A = T...

回答 2 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.