3 Replies Latest reply on Apr 12, 2011 9:26 AM by philmodjunk

    How to test scripts while preserving data



      How to test scripts while preserving data


      What are the best practices to develop and test scripts using data altering commands such as 'Set field'? Unfortunately, the option to undo easily whatever a script did to the data does not seem available (if it is, please let me know).

      So far, I have had the following ideas:

      - add a few dummy records on which to perform the tests.
      Cons: in the case of potentially complex text fields, a few records might not reflect the diversity of the data

      - use 'Show custom dialog' to preview the results of a calculation before giving it the power to actually change data
      Cons: text format (bold, italics, etc) is not shown in the dialog box

      - copy the entire database
      Cons: unpractical

      I would be most interested in reading the thoughts of FileMaker developers on the question. W.

        • 1. Re: How to test scripts while preserving data

          I do all three of the above to be honest. Let me walk you through how I setup a solution to be built...

          1. I make a layout with a tabbed interface called "Elements" and name the tabs Icons, Buttons, Gradients, Custom Images. On this layout I will put copies of any icon, button, or other graphic I use in the solution, just in case I need to use them again.

          2. Then I make a Templates folder and I graphically design the look and feel of the project and make one Form, List, and Table view with the theme and graphics I picked.

          3. I then layout all my main tables

          Once I am well into development I save a "normal" copy of my database every few changes as a revision, for example MYTest.fp7 would then become MyTest_r1.fp7, then MyTest_r2.fp7. Work from revision 8 to make revision 9, then work from 9 to make revision 10 and so on. This way if you find an issue you can always go back a version at a time until you find where it was working, then figure out the issue from there.

          Sample Data

          Yes, often times it is very beneficial to have dummy data in your solution while you work on it to be able to see the work and flow of your project.

          Custom Dialog

          Right again, setting up alert dialogs to let you know the calculation fired is sometimes all you really need.

          Copy Database

          Well I covered this above...

          • 2. Re: How to test scripts while preserving data

            Unfortunately there is no easy way to develop with a database. A database is a growing living thing, the only way to test it completely is with data, but always have a way to test it live without compromising your base data, always use copies and test data.

            • 3. Re: How to test scripts while preserving data

              If you have FileMaker advanced, it is often very useful to run complex scripts in the debugger the first time you try to perform the script. Not only can you see the script succeed or fail one step at a time, you can cancel script execution just as soon as you see that it is going to fail and this can sometimes save you a lot of trouble with having to make a new copy of your file in order to make another test...