Predefined meaningful text or a random string in acceptance tests?

The test case verifies that the user feedback input message is displayed correctly when submitted.

Do you think it would be better to use a meaningful predifined text for the input message or to generate a random string?

2 Likes

What risks are you trying to explore?
What type of process is done with the input?

2 Likes

The point is just verifying that the user input (it’s a post-assessment feedback) appears as it should at the relevant page. So the test case asserts the submitted message to be equal to the initial input.

I just wonder if in such case it would make any difference to whether predefine a text or use a randomly generated one.

2 Likes

Does it mean that no processing is done on this input?
If so, the content itself doesn’t matter, so you can do just a property testing.
If it is processed, you can explore the content to touch the boundaries of your domain, etc.

2 Likes

So long as the predefined massage includes FROM SYS select * ; GO; DROPTABLES *; GO;

I’d not use a random string either for a UAT.

5 Likes

as long as you use also somenthing from here I would be happy

3 Likes

I prefer to use deterministic data where possible. If your test is post-process validation, surely a predefined string is better?

Inputting ‘Banana’ and checking that ‘Banana’ is displayed correctly on the other end is fine for an initial check. Edge case validation using dirty strings etc. can be done in separate checks.

3 Likes

Makes sense! Thank you!

1 Like

If I’m understanding you correctly, either way you’d still be checking what was entered is shown later. As is already mentioned the different inputs can have different focuses. Using a static string is probably good enough to check it kinda works. Using random / special strings checks you can handle those other interesting cases.

// Checks the basic functionality works
Scenario: Message displays correct input
Given I enter "Banana"
When I submit the form
Then the message contains "Banana"

// Check some more interesting data
Scenario: Message displays reserved string FALSE
Given I enter "FALSE"
When I submit the form
Then the message contains "FALSE"
And nothing has exploded

etc ....
3 Likes

I think the title “acceptance tests” might mean different things for some, to me I answered in the context of :

  • I could show this to a customer, sell and install it; and then deal with feature requests, which just might include : “If I enter the message with a single-double-quoted string followed by a backtick the app crashes.”

Acceptance tests are not in my mind designed to catch that, those are bugs that unit and just plain proper testing should catch at various points in the lifecycle and not be prematurely qualified nor be qualified in a redundant fashion. Some of what people are covering with random strings are really in the code-security realm, and fragment the acceptance conversations we should have separately.

2 Likes

Great point. I hadn’t really honed in on the acceptance test level, and rather spoke a bit too generally about test approaches. As you say depends on what is meant by acceptance, system etc to have a good sense of what type of tests are appropriate.

1 Like