- Microsoft Test Manager
- Test Plans
- Testing Configurations
- Assigning Testers
- Test Case Planning Workflow
- Common Scenarios
- Summary
Test Case Planning Workflow
Now that you have seen the Plan tab in MTM, it's time to talk about usability. How do you use it to manage the testing workflow? What are the consequences of managing it in any particular way? How does the usage of it translate into reporting? Before jumping into the planning, take a look at a rough overall software development process. This process, shown in Figure 3-17, is not specific to any methodology.
Figure 3-17 Basic development process with a focus on testing
Figure 3-17 presents a basic development process in which the testers come into play—and roughly when they come into play in an ideal model. The three phases of the development lifecycle where testers work are initial design and construction, testing, and maintenance.
Analysis and Initial Design
During the initial design (for those plans created that deal with the analysis and design phase) the Test Plans look radically different than after the testing team can actually perform tests. Tests in these phases are created to validate the analysis and design of the application. Tests turn a subjective requirement into an objective understanding of what the customer wants.
This is a common practice. Formal specification languages—one of the best known is "Z"—enable you to precisely state requirements. (You can find more information on Z at http://formalmethods.wikia.com/wiki/Z.)
Specifications written in a formal modeling language follow strict mathematical theory that does not, in general, enable ambiguity. However, reading Z or other formal languages can be difficult. A well-constructed Test Case may not meet the rigor of a formal modeling language but can provide roughly the same benefits in an easy-to-read form in much less time. A good Test Case is one with little or (ideally) no ambiguity and provides the same result for every run.
Goal
The goal of Test Cases in the initial design phase is simple: Objectify and thereby validate the requirements. The following is a relatively simple, often-used example. Take a requirement that states the following: Visitors should comment on a blog post. This is a straightforward requirement—or is it? Remember that you are now looking at this requirement from the perspective of testability. You don't necessarily need to come up with all possible tests (virtually impossible in any small system and absolutely impossible in any large system) but you need to make sure that the requirement is testable. For a requirement to be testable, it cannot be ambiguous because if it is ambiguous, it is not repeatable. Before examining the details, look at Table 3-5, which is a use case that documents this requirement in more detail.
Table 3-5. "As a Visitor" Requirement Use Case
ID |
BE-1-1 |
Title |
Visitors should comment on a blog post. |
Description |
Visitors should comment on blog posts. The visitors do not need to be registered to comment on posts but can comment only on blog posts that permit comments. |
Actors |
User (not logged on), Logged on User, System. |
Preconditions |
A blog post must have been published. |
Post-Conditions |
A blog post has a comment attached to it and displayed when the blog post is viewed. |
Normal Path |
1. User navigates to the blog site. |
2. User selects a blog post. |
|
3. System displays the blog post and all associated comments. |
|
4. User elects to add a comment. |
|
5. System provides a comment entry display. |
|
6. User adds and saves the comment. |
|
7. System displays the comment at the end of the list of existing comments. |
|
Alternative Path |
[ID BE-1-1a: User is logged on] |
[Branch after step 1] |
|
1a. User logs onto the site. (User becomes a Logged on User.) |
|
[Resume at step 2.] |
|
5a. System prefills fields with the Logged on User's profile information. |
|
[Resume at step 6.] |
|
[ID BE-1-1b: User has visited the site before.] |
|
[Branch after step 5.] |
|
5a. System prefills all information from previously set cookie (as long as the cookie has not expired). |
|
[Resume at step 6.] |
This use case raises a number of questions. First, what is the order of precedence when pulling cookie information or profile information? In other words, what if a user has logged onto the system before and made a comment (and thereby had the cookie set) and another user who has never made a comment before is using the system? Does the system clear the information? Does it use the cookie information? What about when a user logs onto the blog engine (from the same machine) after a nonlogged-on user has made a comment? Which information do you use? "Can a blog poster comment on his own post?" That's another good question that isn't answered by the use case.
These questions seem minor, and this is a small example, but these can lead to questions that, unanswered, can cause bugs. It also makes it difficult for developers to say they got it right. Testers have to ask these questions to create good Test Cases. Other ambiguous items show up here as well—what information is needed to create a comment? Do I just need the comment, or do I need to provide an e-mail address? What information is actually in the user profile, and just because it is there, do I use it to fill in whatever fields are available? These questions are more important because there is a data model issue here. These fields must be saved someplace, so you must know something about them; otherwise, you may end up having to rewrite the data access code to pull data from a different place.
Having seen this use case, you can roughly infer that there are three "sub" requirements:
- A visitor can add a comment to a blog post.
- Logged-on users can add a comment to a blog post, and their information should be prefilled from their profile.
- If users previously made a comment, their information should be prefilled from the cookie.
Now look at a simple Test Case to validate the requirement (see Table 3-6).
Table 3-6. Simple Test Case
Action |
Expected Result |
Navigate to the blog engine website. |
BlogEngine.NET welcome page displays, and you are not logged in. |
Click a blog post. |
The post detail page displays with the post and all comments listed below it. |
Click the Comment link. |
The page displays places to enter your name, e-mail address, website, and nationality. |
Enter the name Joe. |
|
Enter the e-mail address as joe@nowhere.com. |
|
Enter the comment as Test Comment and click Save Comment. |
The comment displays above all the existing comments and below the blog post. |
This simple Test Case follows the normal path. It also identifies a few details you didn't have before; the user can supply the name, e-mail address, website, and nationality. Now, it doesn't specifically say the fields are required, but it enables users to understand that this is what the developer is coding to, and if they want additional fields, they can ask for them. This Test Case does enable room for ambiguity—what blog engine website? Which post should they click? What information displays in addition to the comment? However, during the analysis phase you may not have anything concrete to latch onto or need that level of information.
The important piece here is that the user now knows exactly what to expect. This is good enough for the analysis phase. The user can say, "If this Test Case passes, the system does what I want it to do." So, at the end of the analysis and design phases, you may have a series of Test Cases marked as either In Design (the initial state of a Test Case work item type) that played a part in validating the requirements, or you may choose to change the state to Ready to indicate it is done and the users have validated the Test Case(s) against the requirement. Mostly, this will be a choice of how you want to report on these during the analysis and design phase. However, you should probably opt to leave the Test Cases in the In Design state so that you will almost always have to do minor updates after the functionality is built and ready for testing. This may include adding or removing steps and putting in concrete controls (such as Select Your Nationality From the Drop Down List as opposed to the preceding scenario in which the Test Case specified that places were merely provided for you to enter your nationality; now the control type is known). In general, a Test Case that is Ready is in a final form that can be executed.
However, this does bring up another point: Test Cases and iterations. Use the following: Iteration 1 is the analysis iteration and as such no testing will be done on this iteration, but Test Cases will be written. It is perfectly acceptable to mark Test Cases in Iteration 1 as Ready when they are completed by the standards of Iteration 1.
Then, when you begin Iteration 2, which is the start of the construction iterations, you may want to duplicate the Test Cases and reclassify them into Iteration 2. This also enables for granular tracking of Test Cases and enables you to say that a Test Case was ready in one iteration but not ready in another. Again, how you do this is up to you and how you want to report on it. The "Scenarios" section provides more detail.
Construction
The goal of Test Cases in construction is straightforward; they should be repeatable to find bugs before the user does and test the functionality of the application. The first and last items are open for discussion. Exploratory testing is not necessarily repeatable, unless you record it. Fortunately, you can record with MTM, so this isn't too much of a problem. The test may not be repeatable because of back-end data or processes, but at least a tester or developer can duplicate the steps taken to find a bug if one is found. The last item can be a bit of a problem.
In a perfect world you can achieve 100% code coverage through functional testing. Anyone who has ever done testing can tell you that this is not possible unless this is your quality bar that usually occurs only in life safety applications. So assume that this isn't going to be possible. What do you test? It goes back to the second point; you should run those tests first that are likely to be used by the user (and therefore the place to find bugs). To make it a bit clearer, in most applications, 20% of the code is used 80% of the time, and the other 80% of the code is used to handle alternative or exception paths. It's amazing how much code applications need to handle these outlying conditions. So a good rule of thumb is that the 20% of the code (100% of the normal path requirements) is tested 100%. All the other code is tested if time is available.
Will there be exceptions to this? Sure. There always are. Using this guideline can help catch the majority of the bugs before the users catch them. Testing the other 80% of the code should be done if time permits or if bugs are found that relate to the outlying conditions. That isn't to say that no testing in these areas should be done, but in general keep it to spot testing or let Unit Testing cover those conditions.
User Acceptance Testing
As an industry, there tends to be a lack of agreements (Service Level Agreements [SLAs] or other agreements) relating to the acceptance of software by the customer. This makes things difficult for the development team. Imagine completing the software for the customer, and after the "final presentation," the customer says, "Nope, this isn't what I wanted," and them asking you to redo parts of it. Who pays the cost for it? Who messed up? Does it matter? Yes. Even if the development team doesn't see it, someone has to pay for the rework, and someone cares about who made the mistake. And that's the thing: It usually isn't a mistake; it's because of changing requirements or misinterpretation. That's why it's puzzling to see this lack of an acceptance agreement.
Ideally, the conditions under which the customers will accept or reject the software are documented in a contract. The best basis for this is that an agreed upon set of Test Cases execute correctly. If this were the case, the customers would be saying that these Test Cases adequately demonstrate the features of the system that you are supposed to deliver. If these Test Cases pass, the system does what they asked you to do, and they can validate that you have delivered that functionality to them.
Now this does a couple of things: The customers have to sign off on the Test Cases. Changes to the requirements cause changes to the Test Cases that require customer signoff. Changes that go outside the scope of the agreed upon Test Cases are easily discoverable because the Test Cases are objective rather than subjective, which allows for ambiguity and therefore changes that aren't discoverable. The last benefit is that user acceptance testing is well defined. Sure, the users can do exploratory testing (that is, playing with the system to see if it works). But the real meat is the execution of the Test Cases, and this makes acceptance easy. The reason is that the Test Cases should have all been executed, at a minimum, twice: once by the developers and once by the testers. The users should almost never find problems with UAT Test Cases. So these Test Cases you create now are of benefit when delivering the software as well.
Are SLAs going to be used? After all this, it is sad to say that the answer is probably no, because there will almost always be some last-minute items the customers want that can cause problems somewhere. Keep a process but be aware of the customer needs. Finding a way to fit both the process and the customer needs together can give you the power to use what has been discussed here. Even if you can't get there right now, start thinking about it now so that when the opportunity comes you can take advantage of it.