Components of a GUI testElements and selectors are the main components that make up a fully functioning test. They form the basis for automating your website or app. You could pretty much drop everything into a single test function and get started with your tests like the following example depicts:
When you start with automation you may find that it’s sufficient to keep your tests simple and automate everything in one go. However, as the number of test cases increases, you might find it hard to maintain an overview in your code. That’s why tests are usually structured into multiple components.
Anatomy of a test fileThe actual contents of a test file in Ranorex Webtestit differ from the automation framework you chose when creating your project. But even as terminology changes the concepts are widely the same.
|Ranorex Term||Protactor||TestNG Annotation(s)||Description|
|Test Test Suite||Scenario||Suite||A collection of test cases|
|Test case||Test||Test||A single, self-contained orchestration of actions followed by an assertion. Can either pass or fail.|
|Setup||beforeEach() beforeAll()||@BeforeMethod @BeforeSuite @BeforeTest||A function executed either before each test case, test suite or all tests.|
|Teardown||afterEach() afterAll()||@AfterMethod @AfterSuite @AfterTest||A function executed either after each test case, test suite or all tests.|
When executing your tests, Ranorex Webtestit treats each test file as a unit. You can choose between executing the current or all test files in your project. Keep this in mind when structuring your tests.