Erroneous assertion not breaking the Scenario
See original GitHub issueWhat are you trying to achieve?
I’m trying to do an assertion in a test Scenario with 2 values taken from two different pages on a website
What do you get instead?
Even forcing the assertion to fail, test keeps outputting that it PASSED.
A snippet of the assertion part:
let assert = require('assert');
I.say('Assertion...');
assert.true(value1 == (value2 + value3));
I need like a I.assertThat(expression) in order for the test to fail when values don’t match. Right now I’m researching about assertions on codecept and trying to figure out a solution for that.
Details
- CodeceptJS version: 1.1.1
- NodeJS Version: 9.4.0
- Operating System: Linux Mint
- WebDriverIO
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Erroneous assertion not breaking the Scenario #884 - GitHub
What are you trying to achieve? I'm trying to do an assertion in a test Scenario with 2 values taken from two different...
Read more >How to continue execution when Assertion is failed
You can declare an assertion that tests both things, but then you're testing two things at once. Better to fix the cause of...
Read more >How do asserts and other error avoidance checks fit into TDD?
It looks to me like you're experiencing cognitive dissonance, trying to believe two contradictory ideas and accept both as valid.
Read more >Programming With Assertions - Oracle Help Center
Each assertion contains a boolean expression that you believe will be true when the assertion executes. If it is not true, the system...
Read more >More Assertions
The one constraint is that assertions that generate a fatal failure ( FAIL* and ASSERT_* ) can only be used in void-returning functions....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I looked at the package.json and found no dependency to ‘assert’, so they must be using the node assert library. https://nodejs.org/api/assert.html
As per the node js docs, there is no
.true
property, so unless you’re using another assert library (or I’m reading the docs wrong).Though I’ve been using the chai (http://chaijs.com/api/bdd/) expect/should module in my project with success. Here’s an example.
I would suggest looking at the source code for the Helpers i.e. in ./lib/helper/WebDriverIO.js. They provide great examples on how to do it.
i.e. this is from the WebDriverIO.js Helper