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.

Filter by
Sorted by
Tagged with
3
votes
1answer
236 views

Exception in thread “main” java.lang.AssertionError: expected [3] but found [3]

System.setProperty("webdriver.chrome.driver", "C:\\Users\\srajendran\\Documents\\chromedriver.exe"); WebDriver driver=new ChromeDriver(); driver.get("http://qaclickacademy.com/practice.php"); ...
2
votes
2answers
673 views

How to verify data is saved or not using selenium?

I am using selenium and java for automation. I am adding new data. after a click on save, data will appear on the left side on the top list and I want to verify. I want to get the first text "new aam ...
0
votes
2answers
32 views

How to use assertion to compare both different size of the rows?

I want both size of the rows shouldn't be matched. int firstnum = 0; List<WebElement> preRoutlList = driver.findElements(By.xpath("//*[@id='txBottomTable']/table/tbody/tr")); ...
-1
votes
1answer
38 views

Assert for element, which is not displayed in the DOM

I've got a basic web payment form, which needs to be automately tested. The form contains five fields - email, card number, card month expiry, card year expiry and CVC code. Also, have two buttons - ...
1
vote
1answer
197 views

Compare 2 JDBC response in Jmeter

I want to compare 2 JDBC responses: I have Source reponse from 1 JDBC request as below in table format: (Source DB)JDBC Response response1: (Target DB)JDBC Reponse 2: I am saving the response as ...
2
votes
2answers
165 views

How to assert checkbox is marked using JavaScript

I’ve problem to assert that checkbox is checked. I’m using automation web testing framework which recording my clicks and generate JavaScript code. The problem is even if the checkbox is unmarked, ...
2
votes
0answers
62 views

how to enable assertions through the Gradle Kotlin DSL?

The simplest possible assert usage I could think of: thufir@dur:~/NetBeansProjects/helloAssertions/src/main/java$ thufir@dur:~/NetBeansProjects/helloAssertions/src/main/java$ ls App.java thufir@dur:~...
1
vote
1answer
83 views

Unresolved reference: enableAssertions

working assertions example using standard Java SE with no imports: thufir@dur:~/jshell$ thufir@dur:~/jshell$ javac App.java thufir@dur:~/jshell$ thufir@dur:~/jshell$ java -ea App Exception in ...
1
vote
0answers
93 views

Testing if the Editfield is editable using LeanFt

We have an editfield that is detected as a Winforms editfield in the object identification center of LeanFt when it is spied upon. Whether it is editable or not depends on some pre-conditions. ...
2
votes
3answers
11k views

How to print a message after checking through TestNG's Assert.assertEquals method?

I'm getting a string value from a function. Now I want to print a message saying whether expected string and actual string are different or not. To compare these string I'm using TestNG's Assert....
3
votes
4answers
4k views

Assertion message with TestNG

I use TestNG for assertion, for example with this assertTrue: Assert.assertTrue(boolean b, String s) If the assert is failed, then the String s will be printed out, and if assertion is passed, then ...
2
votes
2answers
425 views

JUnit Assert's message equivalent implementation using Selenium Webdriver's wait method

In JUnit's assertions you have an optional parameter which allows you to to display it when the assertion fails, to allow the tester know what actually failed from a human-friendly perspective. Is ...
-2
votes
1answer
1k views

How to convert a String to int on assert

Assert cannot be able to find value because it's expecting a String but an integer is present instead. How can I be able to convert this String to an integer. I tried using Integer.parseInt(number) ...
1
vote
1answer
5k views

How to write Assertion in Selenium Cucumber BDD?

I want to use assertion in cucumber to verify my test output, can some please write me an example how to do the same in cucumber. As I googled, I found that people use junit/TestNG assertions like ...
2
votes
0answers
590 views

How to add an assert to an if ..else condition using Phpunit and selenium webdriver

I'm working on test automation for a big project and i'm using Phpunit and as a server i'm using selenium webdriver. In the source code i'm using asserts like : $this->assertContains('Project ...
3
votes
1answer
260 views

Unable to open an .xlsx file with script in Selenium WebDriver- Getting InvalidFormatException

I have a script that requires an excel spreadsheet to be downloaded from a website and opened- ending in an assertion that a certain value exists or not on the spreadsheet. Getting the following ...
3
votes
1answer
5k views

Efficient way to test data quality of database through java?

I currently have to test the data that is being processed from a file into the database. Currently I'm using Java to extract the data from the database and compare the data mapped to the table ...
2
votes
3answers
249 views

How to verify the body context using Assert command [closed]

I want to pass my test.When I run my test it gets fail because expected and actual is not matching. How to do with assert command? When I copy the actual value it shows like an error: {"level":"...
1
vote
3answers
205 views

What elements should I assert for automation of my eCommerce application? [closed]

What are useful and practical asserts to consider in our web automation project which uses selenium (java) to automate an eCommerce web application. As this is my first website to automate, I am ...
0
votes
3answers
4k views

How to test forgot password link?

I want to automate forgot password link. When click on forgot password link It goes to enter the email A link would be send via email. When click on that link we can get the change psssword option. ...
4
votes
7answers
52k views

How to verify a success message using selenium webdriver?

I am unable to verify this sucess message. I am trying to use the following code: 1. String expectedText ="Dear admin, the Institution is deleted successfully!"; Assert.assertEquals("Dear admin, ...
1
vote
1answer
2k views

[Selenium]getAttribute using “textContent” - assertion fails when 'equals' is used but works when 'contains' is used

Here is the sample: WebElement LoginLabel = driver.findElement(location); assert LoginLabel.getAttribute("textContent").equals("Login ID"); Above code fails while asserting but when I try to print ...
2
votes
1answer
181 views

How to assert custom XML response does not return any unwanted tags in SOAPUI?

I wonder if there is a way to assert that XML response does NOT contain any other tags than those expected? I am using plain http requests (no WSDL, schema validation, not SOAP, not REST) and the ...
0
votes
1answer
1k views

Is it possible to display the assertion results in the View Results Tree listener itself in Jmeter?

Is there anyway we can display the assertion results in the View Results Tree listener itself? Also, the Assertion Results listener displays only failed assertions, is there a simple way to display ...
2
votes
1answer
1k views

Selenium: Isolating Assert Fail in Excel Data Driven Loop

Firstly I would like to point out that I'm a beginner when it comes to selenium so I apologise if this is not presented appropriately. I would like to incorporate data driven testing into my ...
0
votes
1answer
946 views

What is the use of waitForPageLoad() method in Framework when our test scripts don't execute unless the page is loaded by default

public void waitForPageLoad(WebDriver driver){ while(true){ String page_status =(String)((JavascriptExecutor)driver).executeScript("return document.readyState"); if(page_status....
1
vote
1answer
1k views

Difference between Hamcrest-library jar and Hamcrest-all jar

What is the difference between using the hamcrest-library-1.3.jar that comes bundled with Selenium Webdriver (I use v2.49) and hamcrest-all-1.3.jar found on the official website of Hamcrest https://...
2
votes
4answers
4k views

Assert in TestNG (Actual int value, Expected int value)

Is there anyway to assert that, actual int value = expected int value not equal to 0 Something like, Assert.assertEquals(length, 0);
5
votes
1answer
19k views

How do I verify a Link URL using Selenium Webdriver / TestNG?

I'm trying to do an assert to make sure a correct XMLHttpRequest is made. I know that I can get the exact Request URL from the Developers Console -> Network tab -> XHR tab's general information ...
1
vote
3answers
577 views

Selenium IDE assertion, text in commented body tag

I am trying to run a test in Selenium IDE, and at the end of the test it looks for the DOM element that is commented out this looks like: </div><!-- QID: Q1447180888OFH--></body><...
2
votes
1answer
402 views

Assertion about size of an XML tag

Community, I'm trying to add an assertion for an XML Response that verifies the size of the info of one of the tags. So for example, this is my response: <description>This is your password</...
2
votes
2answers
2k views

AND/OR Operation in Contains Assertion in SOAP UI

There's one tag in my XML response whose elements (JSON Data) always come in different order. Is there any way to create a contains assertion with AND/OR operations or should I just use a Script ...
1
vote
2answers
3k views

TestNG + java. Difference between Assert.assertTrue and Assertion?

I'm a little bit confused in testNG assertion methods. My question is simple - is there any difference between Assert.assertTrue and Assertion? I mean difference between following: Assert.assertTrue(...
3
votes
5answers
25k views

Is there any way to continue selenium web driver script after assert fails?

I have some script which is written with selenium webdriver. Actually, I have put some assert statement in between script. When an assert statement fails my script stops execution. Is there any way ...
0
votes
1answer
927 views

Assertion error when comparing the text of an element

I am getting the following error while trying to verify an assertion. I tried adding wait, but it didn't help. Error message: java.lang.AssertionError: expected:<Risk Assessment Form: Completed&...