| || |
Selenium TestNg Reporting Issue
In my testNG framework i am executing 3 test cases at a time.
My 2nd testcase has a single method which has try catch block. My catch block does catch Assertion error(Output - Text not Matched---expected [SafeSearch on] but found ) which i get while execution in console. My test also continues forward to 3rd test case & in the end eventually all test cases are reported as passed. I was expecting 2nd one to be reported as failed. Any thing that i am missing here? I has used Throwable to catch error.
In one of separate instance i made some changes to 2nd test case & executed individually. At that time my code was stuck(as it was trying to search for element which was not on page) & when i manually closed the browser it went ahead & reported the test case failed.
Is there anything else i can try?
Without seeing the source, it can be any number of things. These are the things I'd check,
You'll want to check if you tests are completely independent first. Meaning each test can run on it's own without the side effects of other tests.
2nd, you'll want to check if your tests might be sharing some variables. For example, if you're using a class variables, one test could be altering it while another test could be consuming it.
3rd, you'll want to check for synchronization issues. If there are code multiple tests use that has states in the class or during the execution, you might need to use some synchronization blocks and semiphores/locks to make them thread safe.
As per my understanding you are catching exception through coding, and if you wish test to be failed by testng then you have to use assert of testng, something like below:
Can you paste your code here for more idea?
Tags for this Thread