Forum Discussion

jose_pjoseph's avatar
jose_pjoseph
Contributor
8 years ago

How to achieve before() and after() functionality in Test Complete

Is there an equivalent, or is there a way to achieve, before(), after(), beforeEach(), and afterEach() functionality available @ https://mochajs.org/#hooks? I want to execute my tests in the sequenc...
  • AlexKaras's avatar
    AlexKaras
    8 years ago

    Hi,

     

    As it was stated by Robert, TestComplete does not have means to execute some code at the start and end of the whole test run. You may try to emulate this in code. Consider this approach:

    -- I assume that you are testing web application;

    -- For web applications, the first step for almost any test is to get the reference to the tested web page via Page object provided by TestComplete;

    -- You may implement a function in your test code that you will call from any place where you need to get a reference to the tested page. This function will try to find the page and return it if found. Otherwise it will resort to the browser start and site login sequence.