lgirdk / boardfarm

Automated testing with python
BSD 3-Clause Clear License
21 stars 33 forks source link

Test case not failing #352

Closed dollysingh31 closed 4 years ago

dollysingh31 commented 4 years ago

I am trying to run a test case which will compare the SSID of the 2 devices which I connected locally. I can see that even when the comparison fails it is passing the case, which should not be done ideally.

Is there a command to fail the test case if the requirements doesn't match? If yes, Is it possible to give the required command from the test case itself by adding to a function?

mbanders commented 4 years ago

Did you try putting something like this in your test:

assert x != y

In the above line, if x is equal to y then the assert fails and the test will fail. As an example see the test case here: https://github.com/lgirdk/boardfarm/blob/master/boardfarm/tests/ping6.py#L22

mbanders commented 4 years ago

Another way of saying it is that for a test to fail, it has to raise an exception. So doing a raise Exception("The variables were not equal!") would work too.

dollysingh31 commented 4 years ago

Yes, I tried by using an exception. Its working now. Thanks for the support.