Results 1 to 3 of 3

Thread: Sharing code and properties between tests

  1. #1
    Sencha Premium User
    Join Date
    Jan 2009
    Posts
    452
    Answers
    19

    Default Sharing code and properties between tests

    How would I go about sharing scaffolding code between tests if the tests are in different files? Where is the proper place to put the shared code so it's available to all tests?

    Also, is there any place to put properties that can be accessed by all tests? I'm think of something like having a store for userid and password so these don't have to be coded in a test. If I have the answer to the first question, I could probably put them in a shared .js file that isn't checked into source control, though it seems like this could be a common use case worthy of a project setting.

  2. #2
    Sencha - Test Dev Team marcelofarias's Avatar
    Join Date
    Nov 2011
    Location
    Boca Raton, FL
    Posts
    75
    Answers
    5

    Default

    You can add your .js files with the scaffolding implementation in the "Additional Libraries" section of the Scenario configuration. All code in your additional libraries will be evaluated before your test files, so you can call functions or methods as needed. I would suggest having them physically in a "shared" folder in the same test project where your scenarios are (although you can even have "shared" folder at workspace level).

    Then, on each test suite, the beforeAll/afterAll/beforeEach/afterEach blocks can be interesting places to call your shared routines (https://gist.github.com/marcelofaria...2154546fd4cb91).
    Marcelo Bukowski de Farias

  3. #3
    Sencha - Test Dev Team marcelofarias's Avatar
    Join Date
    Nov 2011
    Location
    Boca Raton, FL
    Posts
    75
    Answers
    5

    Default

    About data sources for test data: there's no such functionality in the product at this time, but it's definitely in our backlog. For the time being, your suggestion (a non-VCS .js file) should work fine, I would just be cautious about storing sensitive information in text files, even if they only exist in your local filesystem.
    Marcelo Bukowski de Farias

Similar Threads

  1. Base code sharing among dependent applications
    By sandy1 in forum Sencha Touch 2.x: Q&A
    Replies: 5
    Last Post: 3 Aug 2015, 9:50 AM
  2. Sharing code between Sencha Architect projects
    By emamid in forum Sencha Architect 2.x: Help & Discussions
    Replies: 2
    Last Post: 1 Jul 2013, 6:26 AM
  3. Sharing code between ExTJS 4 and sencha projects
    By jacob.andresen in forum Community Discussion
    Replies: 5
    Last Post: 18 Oct 2011, 5:42 AM

Posting Permissions

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