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.
assert
2,732
questions
1
vote
1
answer
29
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] ...
0
votes
1
answer
22
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 ...
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<? ...
2
votes
1
answer
96
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 ...
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 =...
0
votes
0
answers
15
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(() =>
{
...
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&...
0
votes
0
answers
54
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 ...
0
votes
1
answer
23
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::...
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. ...
0
votes
0
answers
35
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 ...
0
votes
1
answer
73
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 ...
1
vote
1
answer
85
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 ...
1
vote
1
answer
44
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: "...
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": [
{
...