In this lesson, we will learn the following:
- Implement Test Strategy for Framework and how tests are divided on modules
Steps: Implement Test Strategy for Framework and how tests are divided on modules
1. Copy the Test from SubmitOrderTest Class, and paste it into the ErrorsValidation Class, as a 2nd test case
a. Change the name of the test case method, e.g ProductErrorValidation
b. Remember to give each test case method a unique and clear name, to reflect what it is testing
c. Let’s re-name the first test case to, LoginErrorValidation
2. In the new test ProductErrorValidation remove all the code until the assertion for the productName. And we will use this test case as an example to test the product error validation.
a. Let’s change the VerifyProductDisplay argument from productName to “ZARA COAT 33”, so that it will not match. And the variable “match” will get the value of “false”. So let’s change the assertion to Assert.assertFalse. Because we are using this test case as a product error validation test
b. Let’s also change the username input, to another username. Because when multiple test cases are running at cases the same time with the same login trying to add the same product. There would be an overlap and may cause some issues. So, try to register another account in the landing page too, and use it in our test cases.
c. Warning: PLEASE NOTE: We wouldn’t create a new Java Class for this one test case, right Team?
- We can just add this test case into an existing relevant Java Class determined by our Test Strategy, like we are doing now!
- So, for these two test cases LoginErrorValidation and ProductErrorValidation, we could place them into a test module for testing Error Validations, or into separate test modules (Java Classes) by the different page e.g. Landing Page, Product Catalogue page etc. So, how our test cases are structured is determined by our Test Strategy
- Structure Java Classes and Test Cases logically and clearly, so it makes sense and is flexible
d. The benefit of structuring and categorising by Java Class/ Modules, so that for example if we want to only run test cases for Landing Page. We can just run the Java Class/ Modules for Landing Page. We don’t want to run the Java Class/ Modules for the Submit Order Page and Checkout Page etc.
- We can also run tests in parallel. So, we can run for example 20 Java Classes in parallel, instead of in sequence. We will learn this in our upcoming lessons! :slight_smile:
- We can run Test cases in parallel as well!
29 авг 2024