Results 1 to 2 of 2

Thread: Catching ST errors

  1. #1

    Arrow Catching ST errors

    Is it possible to catch errors thrown by ST and handle them as I wish to?

    For example catching the error that occurs when a row can not be located due to an invalid rowindex?

    Code:
    try {
        St.grid(locator).rowAt(index);
    } catch (e) {
        // grid not found
    }catch (e) {
        // row not found
    }

  2. #2
    Sencha - Sales Team daniel.gallo's Avatar
    Join Date
    Apr 2009
    Location
    London, England
    Posts
    375
    Answers
    66

    Default

    As the ST Future APIs are queued up and executed when the components/elements are ready, any exceptions can't be caught in a traditional try-catch situation like you demonstrated above, as the actions from the Futures API will be executed after the contents of the test are parsed.

    In any case, as part of an automated test run I would think it would be undesired for errors to be caught so they are instead output properly as part of the test run results, so you can then fix or improve the tests before running them again.

    The Sencha Test APIs do provide a mechanism to assert that something has failed, for instance if you want to check a component doesn't exist, or you expect a particular action to always fail, you can use the "timedout" API:

    Code:
    ST.component('mycomponent').timedout();  // This checks the component doesn't exist
    Daniel Gallo
    Sales Engineer
    Sencha

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •