This article can be useful for those testers who configure their test environment themselves without the help of the system administrator. The aim of the article is to present a step-by-step description of the installation and configuration of the domain controller, Exchange Server, and MS Outlook with two accounts for the testing purposes.
This article comes from the personal experience. I tested an application that worked with a “living” Exchange system. For testing, I needed a real Exchange server through which it would be possible to send and receive mail for checking different test cases. My task was to find the most optimal configuration of the test environment to configure everything quickly on the one hand and to simulate a relatively real situation on the other hand.
In the simplest case, it is enough to have one machine – real or virtual. Then, there can be variations: to make it more trustworthy, we can use 3 real machines – server and two clients in a separate sub-network. The installation and configuration of the software will not differ much.
Real and Virtual Hardware
For the real system, in the general case, we need two real computers and a switch. The simplest case is when our Exchange is located in its local network without access to the Internet or any other sub-network. We connect the network cables of both computers to the switch and do not forget to switch the switch on. The hardware is ready.
For the VMWare-based sub-network, we need virtual machines with the network of the host only or custom type. The configuration of the sub-network on VMWare is not a subject of this article. More information you can find in the VMWare Help.
Exchange Server requires Active Directory and the last, in its turn, requires the server OS. We use the Windows 2003 Server R2 Enterprise. In the process of installation, we set the name for the server (e.g., bob) and add it to the workgroup. The system updates are not necessary at the moment; the required updates will be described later.
In the properties of the network connection, we set the static IP address (e.g., 192.168.3.1). In the Default gateway and DNS we set the same IP.
Configuring Active Directory
We need to configure DHCP and DNS for the domain controller. That is why it must be located in a separate sub-network not to cause troubles in the main local network.
We need to assign server roles. By default, the corresponding window appears just after the installation or you can call it by selecting Start -> Administrative tools -> Manage your server. Do the following:
- In the Manage Your Server window, click Add or remove role (see Figure 1).
- The Configure Your Server wizard opens.
- Select the Typical configuration for a first server and click Next.
- You are proposed to enter the domain name (the same as the DNS server name). Enter any name (e.g., alice) though the name of the organization is set by default.
- Click Next and then click Next once more. Agree to restart.
- Restart the computer, login, and wait while the configuration completes.
By default, the domain works in the mixed mode, i.e. it supports clients managed by the OS 2000 and lower. Exchange 2007 is not compatible with this mode that is why we need to change the mode.
To change the mode, do the following:
- Select Administrative tools -> Active directory users and computers.
- Right click on the domain (e.g., alice.local) and select the Raise domain functional level option.
- In the combo box, select Windows 2000 native.
- Click Raise and agree that it is irreversible.
- Now we have a domain.
Now we can add the client machine (if it exists) to the domain.
To add the client machine to the domain, do the following:
- Select My computer -> Properties -> Computer name -> Change.
- Instead of Workgroup, select Domain and enter the name of your domain (i.e., alice.local).
- Enter the name of the domain administrator aliceadministrator and the password.
- The client machine is in the domain.
The client machine should be seen in the domain controller (bob server). To view it, select Start -> Administrative tools -> Active Directory Users and Computers -> Computers.
Now we should install some missing software:
- Windows components: select Control panel -> Add or remove programs -> Add/remove Windows components -> Application Server (see Figure 2).
Select the Application server console, ASP.NET, Enable network COM+ access, and IIS options as shown in Figure 3.
- Complete the installation with the following tools:
- Framework 2.0 SP1 (download from https://www.microsoft.com/downloads/details.aspx?familyid=79BC3B77-E02C-4AD3-AACF-A7633F706BA5&displaylang=en );
- PowerShell 1.0 (download from https://www.microsoft.com/downloads/details.aspx?FamilyId=10EE29AF-7C3A-4057-8367-C9C1DAB6E2BF&displaylang=en);
- Update KB942763 (download from https://www.microsoft.com/downloads/details.aspx?FamilyId=308D599A-164A-40F6-B2A2-5DD5728FE5B4&displaylang=en).
Now we can install Exchange itself:
- Start the Setup.exe file.
- Move between pages by default till the Exchange organization page where we can set the name of the organization.
- In the Client Settings, select Yes if you are going to connect to the Exchange via MS Outlook 2003 and lower.
- Readiness checks: if everything was installed correctly till this moment, after the check, there will be 1 successful message and 3 warnings. Do not pay attention to warnings, they will not prevent us from further actions.
- Click Install. The process of installation should complete successfully (all check marks must be green).
- Click Finish. The Exchange Management console (EMC) opens.
We need to have users in the domain to create mailboxes.
To create a user, do the following:
- Select Administrative tools -> Active directory users and computers.
- Expand the tree of our domain.
- Right click Users and select New –> User (see Figure 4).
- In the opened New Object – User window, enter the First name, the User logon name (it can be the same as the First name), and the password (see Figure 5 and Figure 6).
To create the mailbox, do the following:
- Open the Exchange Management Console.
- In the Recipient Configuration node, select the Mailbox sub-node, right click and select New Mailbox (see Figure 7).
- On the Introduction page, select the User Mailbox radio button and click Next (see Figure 8).
- On the User Type page, select the Existing Users radio button and click Add(see Figure 9).
- In the Select User window, select the required user (see Figure 10).
- Click OK. The new user appears in the grid. We can add several users in such a way.
- Click Next. The Mailbox Settings page opens (see Figure 11).
- At the Mailbox database field, click Browse.
- In the opened window, select the only one default path to the database (<server name>First Storage GroupMailbox Database).
- Move between other pages of the wizard by default.
- The mailbox is ready. It is displayed in EMC (see Figure 12).
Outlook Installation and Configuration
As we know, the MS Outlook is installed together with the MS Office installation. We can install the whole MS Office or only MS Outlook.
On its first startup, MS Outlook proposes to configure the mail account and starts the corresponding wizard. Select Yes and move on.
By default, on the Add New E-mail Account page, information about the domain user, under which the MS Outlook was started, is filled (see Figure 13).
If we want to configure the MS Outlook for another user, enter the required address in the Email Address field. Of course, we also need to enter the domain password for this user (see Figure 14).
Click Next. MS Outlook starts checking the server connection.
If everything is configured correctly, MS Outlook displays three green check marks in the end. Then just move between other pages of the wizard by default.
Configuring an Additional MS Outlook Account
For my situation, I needed that the mail came through the Exchange server and the database was supplemented. At the same time, I did not want to assign a separate machine for the client and configure the sub-network.
For such case, we can configure several accounts in MS Outlook and send mail from one account to another by turn.
To configure the accounts, do the following:
- Close the MS Outlook if it was started.
- Select Start -> Control Panel -> Mail (for the Classic View of the Control Panel) (see Figure 15).
- In the Mail Setup window, click Show Profiles.
- In the Mail window, click Add (see Figure 16).
- There can be any user name but for the clarity, it would be better if it coincides with the name of the corresponding user (see Figure 17).
- Then, there is an account configuration again (we already know how to configure an account). Click Next (see Figure 18).
- We receive two profiles in the MS Outlook that are configured for different accounts. We also do not forget to select the Prompt for a profile to be used option (see Figure 19). Then, at each startup, MS Outlook will ask which profile to use.
Now we check how the mail passes. We start the MS Outlook under one account and send a message to another account. Then we start the MS Outlook under another account and check if there is a message from the first account. If everything is correct, each account should receive messages.
So, we successfully provided ourselves with the test environment that is close to the real system. At least, the functional testing of any application connected with Active Directory (AD) or Exchange server can be performed without problems. We can vary the configuration as we like: we can use either real or virtual hardware, install everything on a single machine or connect a number of clients, add specific settings of AD or Exchange, work with Security Policies, etc. Everything depends on what environment properties are required for the testing.
If we need to install everything quickly and easy, we can take one virtual machine and install the whole system with two accounts on it in an hour. If we need the system close to the real conditions, we can perform the same on the real server with several real clients in a separate sub-network.
Anyway, if I had such instruction for my task in due time, it would have helped a lot.
Continue reading with an article from our Development Blog: SQL server query optimization