Test Negative, i need help :C

Hi, sorry for my English, since I don’t know much and I use Google Translate.
The point is that I want to do a negative test, the idea is that if my test falls this is correct. I have no idea how to do it and I hope you can help me here. If you can show me a post to help me or if you give me some idea, I am happy, since I can’t think of how to do it.

Can you show me an example of what you consider a negative test? It would help me understand if you showed me the code you’re working on.

@ivan.jara a negative test is considered passed when the negation of the assertion is true.
so what exactly you have to check?

e.g. check if a is not equal to b

assert a != b

The code complicates me to show it, since I am in a large company and it could bring me problems. But the idea is that I click on the checkbox (which should not work, then the test will fall), before it falls I can capture that it fell and that it is good since it stopped


If I have checked “Airport” I should not be allowed to check in “Editable”, then as it does not let me, I want to click and make it fall. So I prove that the test case falls and works

It should be noted that I tried to verify them all and nothing worked for me.

What you want to do is possible. Without seeing the HTML I can’t help precisely.

Maybe someone else recognizes this HTML output and knows the underlying HTML.

so, you have to check that, in given condition, the element is present, but not clickable or editable.
negative workflows are always tricky
always make sure element is present before to check further! otherwise you may have a fake result

other option is to do a positive workfllow,but enclose the verification in a try/catch. if it raises the expected error, mark as passed, if is raising a different error or none,mark as failed

The issue is that the checkbox allows the click, I think it has a macro that even if I click on it, I haven’t been there, I’ve been trying for 3 days and this is my last option: C

I tried that, but I don’t understand how to capture what is bad, that is, if the click is bad, it must send an error, or some value, how do I get that it is bad?

do first a test with positive workflow.note what error is raised. and further use the try catch and treat only that error.

1 Like

And also, try to use the boolean APIs to test.

I’m going to try, anything I tell you, thanks <3

@ivan.jara every failed assertion / verification rise an exception. that long ugly message. first line of it ussualy says what exception has raised. easy as that :slight_smile:

LE: if you get an error, something is wrong with the code. do not confuse them