This information has a NEW HOME: Please change your bookmark to the NEW HOME:
http://developer.ebay.com/DevZone/guides/ebayfeatures/Basics/Call-SandboxTesting.html#TestingintheSandBoxTesting Applications
Before you begin running an application in the Production environment, you should fully test the application's features and functions to make sure it operates in an error-free manner. In addition, you must be certain that it abides by all API usage rules.
To help with your testing, eBay provides the Sandbox environment (or the Sandbox for short), a special environment designed just for testing. In the Sandbox environment, an application can perform all the same operations it would in the Production environment, except that all users, items, and payment funds involved in the orders are fictitious.
Test users, items, and funds in the Sandbox environment cannot be seen or used in the Production environment. Conversely, real users, items, and money from the Production environment cannot be seen or used in the Sandbox environment.
This section provides information and tips for setting up test users and testing applications on special sites (such as eBay Stores and eBay Motors). The following sections are covered:
Generating Auth Tokens for Test Users
Testing Your Application's API Access
Creating Stores in the Sandbox
For specifics and tips on testing individual calls, refer to documentation on those calls in the Trading API Call Reference. For example, for information on testing GetAccount in the Sandbox, see the following section in the Call Reference:
About eBay Login Credentials
The following login credentials are completely independent and not interoperable across the following sites.
Important: You can avoid common problems that new eBay developers encounter if you understand the differences between the following credentials.
Table: eBay Login Credentials Login Credentials Used By Site Where Used Get Credentials eBay username and password eBay member (real buyer or seller) eBay site UIwww.ebay.com (and corresponding international sites) (for eBay US site) eBay Production authentication token API calls on behalf of a real eBay user eBay APIhttps://api.ebay.com (programmatic access only) eBay Developers Program username and password Developer eBay Developer site eBay Sandbox username and password Test user (test buyer or test seller) eBay Sandbox UI eBay Sandbox authentication token API calls on behalf of a test user eBay Sandbox APIhttps://api.sandbox.ebay.com (programmatic access only)
Using the Sandbox
Before you can operate an application in the Sandbox, you must obtain a set of keys for the Sandbox. You can get the keys by registering and logging into the eBay Developers Program at htps://developer.ebay.com/base/membership/signin/default.aspx.
Operating an application in the Sandbox is essentially the same as operating it in the Production environment. The main difference is that the application needs to be pointed to the Sandbox environment instead of the Production environment. See Routing the Request (Gateway URLs) for more information on how to point an application to either the Production or the Sandbox environment.
The Sandbox duplicates much of the functionality that is on the eBay Web site. It processes API calls in exactly the same manner as does the Production environment, and it includes a subset of the eBay site's Web pages. The difference is that all the users are test users (created by developers like you) and all the money exchanged is test money.
Use the Sandbox to experiment with function calls, to prototype new routines, to test your application's business logic, and to make sure your application adheres to eBay's Compatible Application Check Requirements before you actually apply for the Compatible Application Check.
Before you begin working with the eBay API, and before you attempt to connect to the Sandbox, make sure all the tools in your local development environment work properly.
The sooner you start using the Sandbox, the sooner you will gain expertise in how to send requests to eBay and how to handle the results that are returned.
Automated Sandbox Test Users
Prior to creating your own test users (see below), you can use several automated Sandbox users (provided by eBay) to facilitate your testing. The automated Sandbox users are active in the Sandbox—they regularly add items, buy items, pay for items, leave feedback, open unpaid item or item not received cases, and engage in other activities. The automated Sandbox users enable you to test many calls, such as AddItem, GetItem, GetBidderList, GetSellerList, GetItemTransactions, GetOrders, and GetItemShipping.
The following table contains the user names and passwords of the automated Sandbox users:
Table: Automated Sandbox User Names and Passwords User Name Password 123456 123456 123456 123456
Make use of these test users in your API calls by obtaining Auth Tokens for them using the process described below in Generating Auth Tokens for Test Users.
For definitions of the Sandbox and Production environments, see The Sandbox and Production Environments.
Creating a Test User
Testing an application in the Sandbox requires the use of one or more test users. Test users act as the sellers and buyers of items during the application-testing process in the Sandbox.
Although eBay does provide a few automated Sandbox users (as described above), it is important to create your own test users so you can completely control their Sandbox activities as appropriate for your application's needs.
Registering and Configuring Test Users
The process of registering a test user is different than that for registering a real user in the Production environment. After you register a test user, you can use it to buy and sell test items in the eBay Sandbox.
To create a test user in the Sandbox environment, use the Sandbox User Registration Tool on the eBay Developers Program site, and follow the instructions to complete the registration process for a new test user.
Here's how to navigate to the Sandbox User Registration tool and register a test user:
- Go to the eBay Sandbox User Registration Tool page:
- Log in as a developer, using your eBay Developers Program username and password.
- Create your test user.
- Save the test user's username and password to a place where you can access them as needed.
Please note that eBay automatically adds "TESTUSER_" as a prefix to your test username. Make sure you always include that prefix when you log in as the test user.
- If necessary, use the tool to create additional test users.
- If you are testing only the listing of items, you need only one test user.
- To test both the buying and selling aspects of an application, you'll need to create at least two test users: One test user to act as the seller and one to act as the buyer. This is because eBay rules forbid a seller from bidding on their own listings, a rule that also applies in the Sandbox.
- To fully test multi-quantity fixed-price listings, or to test bidding against auction listings, you should create at least three test users: one test seller and two test buyers.
Depending on the needs of your application, you may also need to perform these steps:
- To make API calls in the Sandbox on behalf of test users, create Sandbox authentication tokens(auth tokens) for each test user as needed. See Generating Auth Tokens for Test Users. For example:
- If your application will list items in the Sandbox, then the test user who will be "selling" those items needs a Sandbox auth token.
- If you will only use the Sandbox UI to test buying your test seller's items, then your test users who are buyers don't necessarily need Sandbox auth tokens.
- If you are creating a buying application (one that uses PlaceOffer), then the test buyers who use your application need Sandbox auth tokens.
- If your test users need to use PayPal in the Sandbox, see Creating a PayPal Sandbox account.
Tips on Working with Test Users
For test users to perform actions associated with a test run of an application, eBay allots a pre-determined amount of credit (play money) to each test user's account. The accounts are automatically refreshed to $500,000 each weekend. This means you can safely retry listing items individually and in bulk without having to pay real fees to eBay, and without any obligation to deliver real items to real buyers.
While an application might only supply functionality that serves sellers (listing items only, no bidding or purchasing), you should test the effects of buyer actions to ensure that the application handles all of the interactions the application may encounter when in production.
In general, even if your application just lists items, you should test it for typical scenarios such as users bidding on items, users winning bids, the calculation of shipping costs, and the non-paying bidder.
Likewise, if you are creating an application that caters only to buyers, you should have at least one test user designated as a seller. After all, a buyer cannot bid on an item unless a seller has listed it.
Generating Auth Tokens for Test Users
Your application needs authentication tokens to make authenticated and authorized eBay API calls on behalf of your users.
This section describes the easiest way to create an auth token for a test user.
Note: If you're looking for information about creating and using authentication tokens for real users (in the Production environment), see Getting Tokens.
To generate an Auth Token for a registered test user, you can follow the procedure described below, or use the Getting Tokens API Flow Tutorial, which includes links to examples.
Getting Tokens API Flow TutorialHere is brief summary of the procedure:
- Log in to the eBay Developers Program site using your normal User ID and password:
- Click the Get a User Token link under the Tools section at the bottom-left of the page.
- Select Sandbox as the environment, then select the Key Set 1 to use for this user.
Before you can select the Sandbox key set, you must have generated a Sandbox key set for your normal User ID. If you have done this, you should be able to select Key Set 1, and the DevID, AppID, and CertID key fields should populate.
Note that test users do not have their own set of keys. Test user keys are associated with the key set that belongs to the User ID that created the test user. This is important because some calls (such as ConfirmIdentity) require that you use a key set in the request.
- Click the Continue to generate token button.
The Sign in to Link Your eBay Account page displays.
- Enter the User ID and password for the test user for whom you want to generate an Auth Token.
The test user's User ID usually begins with "
TESTUSER_".- The Token Generation — Final Step page displays, providing the test user's Auth Token and tokenexpiration date.
Save the Auth Token and expiration date to a place where you can access them whenever you want to make calls on behalf of the respective test user.
After generating individual authentication tokens for each user, place the respective test user's Auth Token in the eBayAuthToken field of your API request. Make sure to use the proper Sandbox endpoint, depending on the format of your request. See the Getting Tokens API flow tutorial listed above for examples.
Testing Your Application's API Access
Some API calls have access rules. The rules define how many times an application can use certain API calls each day or hour. Your application also has an aggregate call limit, although not all calls are counted toward the limit.
Your application can detect and report the current API access rules and its current usage with GetApiAccessRules, which shows which API calls have limits, what the limits are, and whether they count toward the aggregate. Each ApiAccessRule defines a rule, and you can parse for various values.
In your application, you can check for the hourly or daily usage of a specific call, say AddItem. Check your application's API access when you test it in the Sandbox, and also while your application runs on the Production server. Call rate limits are set at the sole discretion of eBay. When your application goes through the Compatible Application Check, your application will be rate-limited on an application basis or a per-user basis, depending on your customer base and distribution format. Application-based call limits mean that your application will have a maximum API call cap on a daily and monthly basis. The user-based call limits mean that each user of your application gets their own pool of API calls. One person's usage does not affect another's, so as many people can use your program as you'd like.
To learn more, refer to the Compatible Application Check page on the eBay Developers Program site:
If you decide to go through the Compatible Application Check, ensure that your application complies with eBay policies:
Creating Stores in the Sandbox
If you want to test your application's ability to list items in an eBay Store, you need to set up a storefront in the Sandbox. See Creating a Store.
For conceptual information on eBay Stores, see eBay Stores.
| http://developer.ebay.com/DevZone/XML/docs/WebHelp/DevAndTestApplications-Testing_Applications.html | |
| © 2004–2013 eBay Inc. All rights reserved. | Version 825 |