I need assistance with Robot Framework. How can I create test scenarios? By test scenarios, I mean combining multiple test cases together. For example, if I have the following test cases:
1.Login backend
2.Add content backend
3.Edit content backend
4.Check frontend content section
And then I have the following test scenarios: 1.Login backend -> Add content backend -> Check frontend content section will update 2.Login backend -> Edit content backend -> Check frontend content section will update
Alright, so now, how can I proceed to write these in Robot Framework? Currently, in the *** Test Cases *** section, I have written out 2 test cases:
- Login backend -> Add content backend -> Check frontend content section will update
- Login backend -> Edit content backend -> Check frontend content section will update
Both of these test cases have the Login backend and check frontend content section commands repeated. Is there a way for me to reduce code redundancy? For example, could I write Login Backend and check frontend content section as functions and then call them later in the *** Test Cases *** section?
Sure, you could wrap any actions as a
keyword(the RobotFramework name for functions/methods) and then reuse it.It is explained in the User Guide.
So,
Login backend,Edit content backend, andFrontend content section should be updatedcould be keywords that could be reused. For example, very high-level:backend.robotwith keywords, like:sanity.robot: