Testing a app script - unit-testing

I have created a script via Drive|New|App Script
Now I want to test it. This must be so fundamental that it must be obvious, but it is not to me.
My script is for a Document. I used the code example from this "Translate" example, https://developers.google.com/apps-script/quickstart/docs
I have tried creating a new document and then from the menu Tools|Script-editor I have gone looking for my saved project, but the "Open recent projects" is empty.
How do you test/run a saved app script project for a Apps Document?
Thank you in advance.

If created Via Google Drive you can type the following in the search whilst in Drive (Drive.google.com)
Type:Script
This should return all the scripts created manually which are not attached to specific Sheets/Docs/Forms (i.e you have used the Drive tool to create a script or used the URL Script.google.com)
If you have created it this way and want to run a function to interact with a Google Sheet/Doc see the following example.
SpreadsheetApp.getActiveSpreadsheet()
CHANGE TO;
SpreadsheetApp.openById('SHEETS ID GOES INBETWEEN THESE BRACKETS').getSheetByName('Sheet1')
https://docs.google.com/spreadsheets/d/UNIQUE-ID-IS-HERE
OR YOU COULD CREATE A NEW APPSCRIPT USING THE TOOLS>SCRIPT EDITOR
All tests on appscript are run using the '>' play icon or 'RUN' then select your function.

Don't create your script in "Drive|New|App Script". Open a new Google Doc, open "Tools|Script editor..." and write your code in this new app script project.
Normally this must work!

Short answer
Follow the referred tutorial instructions.
Explanation
The path that you followed to create the script project, creates a stand-alone script project, but the referred tutorial is about a Google Document bounded-script. The code include triggers and methods that only work on this kind of script project.

Related

The problem of widget isn't invoked using google assistant

Do anyone have the similar problem to control Android apps (from google codelab - fitness app) with their voice, using Google Assistant?
In my app, I tried to activate widget using google assistant (app action tool test), but google assistant doesn't give any respond. Therefore, I used the example code google gave to run, but it still has similar problem that widget isn't invoked when I use app action tool test to test the app.
Sample code google provided:
https://github.com/actions-on-google/appactions-fitness-kotlin.git
the shortcut looks like below and how :
enter image description here
Update:
After updating the new running record, the app won't respond when I want to trigger widget after the first time I can do it successfully. Do anyone have similar question or know how to solve it?
App updates running record
The widget cannot update/display the new running record
widget cannot be trigger to get new running record
I'm assuming you're talking about the codelab titled Integrate Android Widgets with Google Assistant.
I've been able to get this codelab to work - mostly.
When testing using the App Actions test tool:
Make sure you have uploaded the app to a project in the Google Play Console. You'll only need to do this once, even if you change your code.
Make sure the account you're using for Android Studio, Play Console, and Google Assistant on your device are all the same.
Make sure you've compiled the app and deployed it to your device. The easiest way to do this just to run it from Android Studio the first time.
When you create the preview, set the name and Locale.
Even tho these are listed as "optional", these make it easier to debug.
The App name should be something you know will be recognized by voice and not used by any other app. I tend to use things like "Splat" and "Bogus".
Set the locale to en-US
Click "Create Preview"
Once the preview is created, you can test the widget running by
Setting the Intent to GET_EXERCISE_OBSERVATION
Changing the value in the "name" property to something like "run". ("Climbing" will also work, but tell you that you don't have that activity logged.)
Making sure the target device is the one you're testing on.
Clicking Run App Action
And you should see the widget appear in the Assistant on the device.
You don't need to use the test tool, however. Once you have created the preview with the Test Tool, you can just test it right on the device:
Start the Assistant by long-pressing on the home button.
Saying or typing a request such as "How far have I run with Bogus" ("Bogus" being the name I've chosen this time
If you have issues with the emulator, there are some other troubleshooting steps which may be useful depending on the error message you get.
Now, I did say "mostly". I have seen issues where it will stop responding at all, either via the Test Tool or directly via the Assistant. A few things that I've done that often (but not always) help:
Delete and then create the preview again.
Remember that the Preview is only available for a few hours.
Force stop the application.
Force stop the Google Assistant.
Even if you don't see a message, check out the Troubleshooting steps for "Sorry, I couldn't find that"

Is there any way to run Apps Script web app with triggers

I have a Apps Script web App which performs all the work by its own only it's need to be opened manually.Now I just want to use triggers to open that web app at a particular time.
Here is the link of my code https://www.w3schools.com/code/tryit.asp?filename=GQTU37F2FMIP
In this link only the recording part is there.After this the video file gets uploaded to my Dropbox which is not included as I lost that code but if this code could execute with triggers then I will work on it and Provide the code here.
Thanks in advance and sorry for my bad English.
You could probably set up a trigger to execute a script the performs the get with UrlFetchApp.fetch();
Will canvas element execute on window.onload(I have provided the code)

Stackdriver Logging not recognizing Google Apps Script project from Team Drive

I was using Google Apps Script for standard document-bound functions in a personal Google Drive. For debugging and general info-printing out, I was using console.log() calls and looking at the Stackdriver Logging output for that particular project.
I recently copied many of the documents and their associated code projects into a new Team Drive. The new files are completely new (not shared into the Team Drive) and they have a different creator than the originals.
Now when attempting to view the log outputs, Stackdriver Logging gives me this error message:
Failed to load
Tracking Number: XXXXXXXXXXXXXXXXXXX
What's more, the "Select a project" dropdown at the top of the page does not list any of the projects.
I've tried creating a brand new script project in the Team Drive, but that does not appear either. The Stackdriver page is logged into the correct account.
I'm aware of other solutions, such as Logger.log(), but would rather not resort to them unless I can't get Stackdriver to work again.
Edit: I found this question, which includes this sentence:
I have reset the script's Cloud project to be a "real" project (as opposed to the default hidden one).
This sounds important but I have no idea what it means and have been unable to find anything relating to making projects unhidden. Is this my problem?
I have found the solution, though I don't fully understand it.
Google Apps Script projects are associated with a hidden Google Cloud Platform project behind the scenes, which allow them to print to Stackdriver Logging, among other things. Trying to run them out of a Team Drive makes this not work for reasons that are a mystery to me.
Here is the fix:
Manually create a new Google Cloud Platform project.
Associate your scripts with the new project. In the Script Editor, go to Resources > Cloud Platform project. In the dialogue, enter the project number of the project you just created, and then hit Set Project. To find the project number (distinct from the "Project ID"), click on View API Console, and then make sure you have your new project selected at the top of the page.
This needs to be done for each GAS project. Whereas in Drive, separate projects often can't be combined into one since each is bound to a single document, all of your GAS projects can be associated with a single Google Cloud Platform project.

How do I create a TFS2017 Build Task equivalent to Visual Studio's Web Deploy Publish method?

I am trying to complete Continuous Integration/Continuous Deployment automation for a web application project. I have been helped by a series of SO posts link1, link2, link3 and things are now running, except the upload to the hosting server is longer than it needs to be; I currently upload all files instead of just the ones that changed.
When creating the TFS2017 Build (or Release) there are many Task options, including some from the marketplace. I'm referring to, in this case, the dialogue for a Build as shown below:
I'm currently using a PowerShell script which seems a little archaic and inefficient as noted above. Do any of the tasks available to us mimic the Visual Studio 2017 Web Deploy Publish Method which runs quite nicely and quickly? If not, what can I use for an 'intelligent' upload process that checks whether or not a file must be uploaded?
Unfortunately, there is no this kind of build task could mimic the Visual Studio 2017 Web Deploy Publish Method for now.
The method trough VS IDE will dynamically check if some files need to be uploaded or not.
However through TFS build task or powershell script will not do this, just simply copy all files you assigned. Afraid there is no workaround for an 'intelligent' upload process that checks whether or not a file must be uploaded. Since we don't how VS IDE did this.

Error when adding web service in Script Task in SSIS?

i have this task to send a RS report (event driven) in SSIS. I have this script task that extracts the report and another script task to send the email.
In my script task I'm able to add the web reference, reference it in the code, build successfully and save it.
http://{YourReportServerURL}/reportserver/reportexecution2005.asmx
BUT when I exit the script task editor I get a script error saying "Script contained in the package have compilation errors. Do you want to save changes?"
A red cross appears on it and it says "The binary code for the script is not found.". I set the DelayValidation to true to remove this red cross.
When i execute the package, it fails because of the The binary code for the script is not found error
By the way these are my references:
http://www.travisgan.com/2013/09/ssrs-data-drive-subscriptions-part-3.html
http://www.macaalay.com/2014/04/02/how-to-create-data-driven-report-subscriptions-in-sql-server-standard-version/
Im using VS 2010. how can I solve this problem? I need your help!
Thanks in advance.
Please take a look at SSIS Package failing because “script task is failing because the script is not precompiled”. Your problem looks similar to the described in that issue.
Basically, you need to make sure that VSTA project code is set to MSIL, build the project and save it. After that - close VSTA editor, and click Ok on the Script task.