Current filter:
                                You should refresh the page.
                                  • I need to enter an unique data for the same test each time when the test is running. How can I set up the test so that a different data is entered each time? 

                                1 Solution

                                Creation Date Importance Sort by
                                You can use the free Faker.js library to generate random data each time when running a test. To do this, perform the following steps:

                                - Download the Faker.js file from here;
                                - Reference the file using the "@require" directive:

                                [JavaScript]
                                "@require ../modules/Faker.js";
                                - Use the Faker.js API to generate random data. For example:

                                [JavaScript]
                                var randomName = Faker.Name.findName(); var randomText = Faker.random.catch_phrase_descriptor();

                                Here is a complete sample to test the TestCafe demo page:

                                [JavaScript]
                                "@fixture Fake.JS example"; "@page http://testcafe.devexpress.com/Example"; "@require ../modules/Faker.js"; var randomName = Faker.Name.findName(); var randomText = Faker.random.catch_phrase_descriptor(); "@test"["Example with random data"] = { "Type name": function() { act.type($("#Developer_Name"), randomName); }, "Click 'I have tried TestCafe": function() { var div = $(".mask").eq(6); act.click(div); }, "Type in text area 'Please let us know what you think:'": function() { var textArea = $("#Developer_Comments"); act.type(textArea, randomText); } };
                                • Robert Jones 14 01.22.2015

                                  What if I need it to add in text on a field where the data is always different but it's not random, it's from a generated list. To explain further, one field on our form expects a unique code that is generated from a backend process. I have access to see the new lists of generated codes but once one is used it cannot be used again.

                                  Any advice or help will be greatly appreciated.

                                • Marion (DevExpress Support) 01.22.2015

                                  Hello,

                                  To process your recent post more efficiently, I created a separate ticket on your behalf: T200252: How to run the same test with a different set of data each time. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.