diff --git a/README.md b/README.md index b61b246..1ae35b5 100644 --- a/README.md +++ b/README.md @@ -21,19 +21,40 @@ var bs_local = new browserstack.Local(); // replace with your key. You can also set an environment variable - "BROWSERSTACK_ACCESS_KEY". var bs_local_args = { 'key': '' }; + +function yourTest(callback) { + + // your test goes here + + callback() +} + + // starts the Local instance with the required arguments bs_local.start(bs_local_args, function() { console.log("Started BrowserStackLocal"); -}); -// check if BrowserStack local instance is running -console.log(bs_local.isRunning()); + // check if running + if (bs_local.isRunning()) { + + // run your test here + yourTest(function() { + bs_local.stop(function() { + console.log("Stopped BrowserStackLocal"); + }); + }); + + } else { + + // Error + console.log("BrowserStack Local didn't run properly"); + + } -// stop the Local instance -bs_local.stop(function() { - console.log("Stopped BrowserStackLocal"); }); + + ``` ## Arguments