google app script gmail testing - testing

I want to make a clean up script for Gmail to my needs. I happy to use a script, which code I found in a blog, but now I need to modify it.
How can I test it without risking my Gmail box? I'm not good or experienced inJS, so I'm pretty sure there will be some mistakes. And I don't want my emails messed up. Is there a sandbox, or some kind of testing environment?

No, there is not. You should create a test account for you to work with.
Also, when working with your account. You could always just log an action instead of doing it. i.e. instead of
thread.moveToTrash()
do a
Logger.log('move thread "'+thread.getFirstMessageSubject()+'" to trash');
Then check menu View > Logs to verify the actions your script would do. You could also create a TEST variable and use it as condition in your code to determine if it should perform an action or just log it (or both).

Related

If the client keeps on changing the requirements every now and then, then what testing method should be followed?

I always perform regression testing as soon as the changes come up. The case is the client comes up with changes or additional requirement every now and then and that makes the case more messy. I test something and then the whole things get changed. Again I have to test the changed module and perform integration testing with other modules that is linked with it.
How to deal with such cases?
1) 1st ask complete Clint requirement and note every small point in doc.
2) Understand that total functionality.
3) Use your default testing method.
4) Your not mention which type your testing.( app or portal )
5) As well as possible which is comfortable and feel easy you continue that testing.
6) You want automation testing.please use this (App-appium or Web-selenium)
I hope this is helpful for you.
I would suggest you the following things
->Initially gather all the requirements and check with the client if you have any queries through email.
->Document every thing in MOM whenever you have client call and share with everyone who has attended the call(dev team,client,business,QA)
->Prepare a Test Plan strategy document, test cases and share it to client and request him for his sign off.
->Once, you are all set start with smoke testing then check the major functionalities in that release and then could proceed further.
->You could automate the regression test cases as you are going to execute them for every release(I would suggest to use Selenium if its a desktop application then UFT).
Kindly, let me know if you have any queries.

Bypass login between each scenario?

I am using rspec/capybara here.
I'd like to be able to log into the system only once, then run a bunch of scenarios. Should a scenario fail, it can effectively move onto the next one.
The problem is that once a scenario fails, a new browser session is started and I am asked to log in again. Is there a way around this?
How is this type of testing handled? Many systems require a user to log in first prior to exercising all its functions/features.
So many ways to achieve this but I myself prefer a new instance per spec at least if not context or sometimes even it. I like atomic self contained tests.
Anyway, if you decide want to do this, then you could;
Reuse a cookie session between tests but still open a new browser. Obviously this depends upon the system under test
Create a global Before all which only creates a browser and sign in if you are not already signed in.
Create a global After all which navigates to a known state (eg. Home page) but doesn't log out.
There are many approaches which could work

how to get the data from captcha in selenium webdriver

I'm using Selenium webdriver (Java).
I need to test the registration form but before submitting, image box (captcha) is appearing but everytime of execution it is going to be changed. I want to know how to get the data from image (captcha).
Anyone can help me?
If the captcha is coming from an environment under your control, you will likely need to implement some sort of method indicating you are in a test environment and have the captcha system return a known value or some indicator of what the expected value is.
If, on the other hand, the captcha is coming from another source out of your control, you are probably our of luck. At that point, you are essentially in the same boat as the spammers who are in a constant arms race to write software that can visually parse a captcha.
UPDATE
I feel the need to add some clarification to the ideas put forth in the question, answer and comments. Essentially you are dealing with one of the following situations (note that when I say 'your', I am referring to you, your company, client, etc):
1) Your form, Your captcha system: If this is the case, your best solution is to work with your developers to add a 'test' mode to your captchas, returning either a known value, or additional information in the page that indicates what the expected value should be. If you are able to make use of a tool, either written by you, or by another, that can successfully 'read' the captcha image, your system is broken. If you can do it in test mode, what is to stop anyone else (spammer, hacker, etc) from bypassing your captcha in exactly the same manner.
2) Your form, 3rd Party captcha system: If this is the case, your best solution is again to see if the system has some 'test' mode that you can make use of. I have no experiance with these systems myself but in general would guess that test methods exist for the major systems out there. A Google search of {Captcha System Name} automated testing should return some good hints as to how to go about testing with the system. If nothing good comes from that, your next bet would be to implement your own, internal, test only, dummy captcha system that works with some known value and make your captcha provider configurable so that you can point to your test system in test/dev/etc and your real system in production.
3) Another Form, Unknown captcha system: I am going to make a leap of faith here and assume this is not your case, but just for completeness I will include it. If this is your case, your not testing anything at all and are simply asking for help bypassing someone else's security mechanisms for your own reasons. If that is the case, please seek your assistance on less scrupulous sites.
Captcha code was introduced in order to prevent from the robot or automation codes. There is no option for automating the Captcha code.
1 . You can give a wait time for the automation, so that the user can enter the captcha code.
2. If the project is in testing url means, you can request your system admin and developer to disable the captcha validation.
May be this can help you, but i din't try on this..
Developers will generate a random value for captcha, and they will convert the value into image as well as they will store the value in session for comparing the entered input is matching with the captcha code.
So If possible, you can take that session value and give as the input.

can I validate input on MTurk?

I've written a HIT on mturk asking people for domain suggestions. Is there any way to ensure that the domain has valid syntax at the time of entry or submission?
So it turns out you can embed an iframe within the HIT. This allowed me to embed a form which I could then validate in any way I pleased. It requires the worker to copy the result of the form into the HIT form.
I think to do this the 'proper way' (i.e. no need to copy-paste) you'd need to use an ExternalQuestion. This can be done via either the API (various languages) or the command-line client.

UserProperties being shared between users in Google Apps Script published UI service

I am working on a google apps script that is being published as a service, and accessed by multiple users via the UI.
The problem I'm having is that when one user causes a UserProperty to be set, all the users subsequently have their UserProperty set to that also. In other words it is acting like a ScriptProperty, rather than a UserProperty, in that it is not User specific. All users appear to cause this to happen.
I have studies my code and I just cannot see that it is anything to do with that. I make no reference to EffectiveUser, so only ActiveUser could ever be setting these values.
My guesses are:
- I am misunderstanding the scope of UserProperties
- My variables have somehow become corrupted (I have had problems with other UserProperties variables doing some odd stuff)
Has anyone experienced this, or does anyone have any suggestions?
Regards
Chris
UserProperties are better suited for scripts that run inside Spreadsheets and not published ones. The reason is that a published script runs under the user id of the user who created the script and not as the person who invokes it.
So, if the script is written by someone#example.com, then the UserProperty will be that of someone#example.com irrespective of who invokes the script. So, when one user writes a UserProperty, all others see the same value