Skip to main content

Questions tagged [assert]

An assertion is a statement, which aborts a program when it evaluates to false. Assert is typically used for debugging and situations which should never happen.

1 vote
1 answer
27 views

Assert Success in Matlab Without Using Classes

I am writing a validation function in Matlab R2020 to ensure that several arrays meet length requirements before they are processed. The function looks something like function [arr1, arr2, arr3, arr4] ...
AmericanJael's user avatar
0 votes
1 answer
21 views

Jmeter: how to only perform last check once and only when first thread has completed all loops

I have the first part of the test which is to send X messages to a specific rabbitmq queue, and this being a load test I need to set it with multiple threads and loops. The second part of the test is ...
Amphata's user avatar
  • 25
0 votes
1 answer
61 views

Asserting availability of SubTypes of T

I would like to assert whether every element of an array is a sub type of a particular class. So I wrote a helper like this: private <T> void assertContainsAllSubtypes( List<? ...
bdhar's user avatar
  • 22.6k
2 votes
1 answer
89 views

How to create warning assertions in Playwright TypeScript tests for non-critical failures?

How to create warning assertions in Playwright TypeScript tests for non-critical failures? I'm working on Playwright tests using TypeScript, and I need a way to handle assertions that throw warnings ...
Barış Can Ateş's user avatar
0 votes
1 answer
37 views

How to get detailed assertion error messages from an external assertion function in pytest?

I'm trying to move assert statements out of my test function into a separate function when using pytest. Here is an example: def assertions(): assert 1 + 1 == 2, 'Addition error' assert 2 * 2 =...
sapfir0's user avatar
  • 11
0 votes
0 answers
14 views

Nunit 4 assert text does not have assert statment inside () Eeg.: Assert.That(, )

c# net4.6.2 + nunit 4.1 test code [Test] public void DummyMethod() { var someVar = false; Assert.Multiple(() => { ...
igor's user avatar
  • 53
0 votes
1 answer
30 views

XSD: assert to check that values of several elements from same type are not equal

Using XML version 1.1 For a game I have build a complex structure called "connected_condition". Its code is looking somewhat like this: <xs:complexType name="connected_condition&...
Daniel Janz's user avatar
0 votes
0 answers
52 views

Unit test for pandas NA values in dataframe

I have a function which gives me the following output (pd df): timestamp duration trial_type blink message 9199380 <NA> NaN <NA> RECORD_START 9199345 392 fixation 0 NaN etc... column ...
Julia-Katharina Pfarr's user avatar
0 votes
1 answer
22 views

Why can't I do an assertion in a GMock `EXPECT_CALL`?

I'm using gtest/gmock-1.12.1 in my project. I need to do an assertion when a mock method being called, like this: #include <gmock/gmock.h> #include <gtest/gtest.h> using namespace std::...
Leon's user avatar
  • 1,997
0 votes
0 answers
18 views

Problem requires an assertion to make sure given string does not have any numbers as part of it. Is there a way to do this without isalnum()? [duplicate]

This is the code I wrote so far. The rubric requires me to assert that the string input has alphabets, whitespaces and some special characters(!,@, etc.), but numbers are to raise an AssertionError. ...
Sid Naik's user avatar
0 votes
0 answers
34 views

How can I assert JSON body hidden inside HTML tags with REST Assured?

I have response: <html> <body>{"name":"test","value":"new","_id":"578641fec44c56220b15e5f9"}:</body> </html> I ...
Sunbro _'s user avatar
0 votes
1 answer
69 views

Pytest and PyCharm: how to get <Click to see difference> always?

There is a difference in the assert output of Pytest in PyCharm depending on if function with assert in the same file or in the another file. Let's consider an example. tmp.py: from utils.tmp_1 import ...
Diggy's user avatar
  • 135
1 vote
1 answer
80 views

"Assert function" does not change type

I'm trying to make a package like zod for npm but when parsing it it doesn't update the previous type: function isString(val: unknown): asserts val is string { if (typeof val !== 'string') throw new ...
Sercrac 07's user avatar
1 vote
1 answer
43 views

Cucumber TestNG Assert fails with java.lang.NumberFormatException

I'm using a simple Maven project. Whenever I run the assert in cucumber, it fails. but when I run in a normal project, works flawlessly. Error: java.lang.NumberFormatException: For input string: "...
Megaya's user avatar
  • 33
1 vote
0 answers
49 views

Rest-Assured and Hamcrest matchers not working with comparing arrays of ints

With Rest Assured i'm parcing rest-response and comparing arrays. Response body: { "error": { "errorObjects": [ { "risks": [ { ...
Sunbro _'s user avatar

15 30 50 per page
1
2 3 4 5
183