Story

Throughout the Portal series, you take on the role of Chell, a young woman trapped within the Aperture Science facility. Chell is forced to solve tests of varying difficulty in chambers designed by a psychopathic AI named GLaDOS. During the early stages of the testing, Chell is granted usage of the Aperture Science Handheld Portal Device (commonly referred to as the portal gun), a piece of equipment developed by Aperture Science that allows Chell to create portals that act as gates between each other, allowing Chell to quickly traverse areas or reach normally unreachable places.

Portal
Portal has two distinct parts, the test chambers, and the escape.

Act 1: The Test Chambers
The game begins with Chell awakening in a Relaxation Vault, where she is briefed by the voice of GLaDOS coming from speakers, before being released through a portal. The player is introduced to the testing process and mechanics, shortly thereafter obtaining the Aperture Science Handheld Portal Device. As Chell makes her way through test chambers, it becomes clear Motivated with the promise of cake at the end of the testing, Chell is put through tests of increasing complexity.

Portal: Still Alive
Portal: Still Alive is an XBOX Live Arcade port of Portal, containing additional content in the form of new advanced chambers, inspired by Portal: The Flash Version, with no additional story material. This version of the game is not canon to the story, as it's confirmed by anonymous Valve developers.

Portal 2: Lab Rat
The Lab Rat comic bridges the gap between Portal and Portal 2, which introduces us to Doug Rattmann, a scientist at Aperture Science

Part 1
Part 1 follows Doug Rattmann as he is tracking Chell through the Enrichment Center. He is having a monologue about reality and how the mind sees it and is shown to be psychotic, forced to take ziaprazidone [sic] to curb the effects of his schizophrenia. Through the story, he carries a Companion Cube that he hears talking to him and giving him advice. The main story is also intersected with flashbacks of the period during which GLaDOS was still being built, showing Rattmann's involvement in the project.

Soon after discovering Chell, it appears he has not taken his medication for a while, and he takes his two final pills, against the Companion Cube's advice not to take them. A first flashback is shown, with a younger Rattmann overhearing two colleagues saying they put cameras in the cameras, something that an unidentified person is not to suspect. While he runs through the facility and makes another mural, Chell reaches Test Chamber 19,

Then another flashback set in GLaDOS' chamber is shown. There Rattmann is seen working with his colleague Henry, who compares their breakthrough with GLaDOS to Einstein discovering relativity and NASA reaching the Moon. Rattmann expresses his doubts about GLaDOS' reliability,

Back to reality,

Then a third flashback has Henry showing Rattmann the newly designed Morality Core,

Again back to reality, the Cube tells Rattmann to run away while he is outside, but feeling he is responsible for the whole mess, he prefers to get back inside,

Part 2
Part 2 opens with Doug Rattmann traversing the innards of the facility. The Companion Cube informs him that the anti-psychotic he took in Part 1 is starting to work, as the Cube slowly fades to silence.

Time for another flashback, this time set after Rattmann,  is taunted by GLaDOS about his schizophrenia as he escapes from the main testing facility. While GLaDOS continues to taunt and manipulate him, Rattmann manages to reach the file room where he finds

Back to reality, Rattmann is lying on the floor, wounded by the Turrets, reaches out to his Companion Cube but loses consciousness.

Another flashback begins, involving Henry having a conversation with GLaDOS. During the conversation, she tells him she would like to perform a recreation of the Schrödinger's cat experiment during "Bring Your Cat to Work Day". She says that added to the boxes and the cats, she needs a little neurotoxin. Henry, accepts, "as long as it's for science",

Doug regains consciousness, and his schizophrenia has returned. The Cube can talk again and asks about to which he admits it was just a hunch. The Cube then tells Doug to

Exhausted, Rattmann crawls into the bed of a Relaxation Vault and presumably falls asleep. It was later revealed by Valve that Rattmann

Chapter 1: The Courtesy Call (Act 1) / Chapter 2: The Cold Boot (Act 2)
These chapters include:
 * Aperture Science Extended Relaxation Center.
 * Decrepit Test Chamber 00 through 08 (out of 19).
 * Central AI Chamber and Main Breaker Room.
 * Incinerator Room.
 * Decrepit Test Chamber 19.
 * GLaDOS' testing track.
 * GLaDOS' testchambers 01 through 08.

Chapter 3: The Return / Chapter 4: The Surprise
These chapters include:
 * GLaDOS test chambers 9 through 13 (Chell falls down the catwalk at 13).
 * Constructed test chamber (Chell finds out the door is broken).
 * Return of GLaDOS' testing track and test chambers 14 through 17.
 * GLaDOS' surprise and test chambers 18 through 22 (Wheatley breaks in at 21).
 * Behind-the-scenes concept.

Chapter 5: The Escape
This chapter includes:
 * GLaDOS Chamber.
 * Turret Manufacturing Line.
 * Turret Redemption Line.
 * Neurotoxin Generator.
 * Neurotoxin Generator Controls.
 * Roller Coaster (but with a tube).

Chapter 6: The Fall (Act 3)
This chapter includes:
 * Old Aperture.
 * Pump Station Alpha.
 * Repulsion Gel.
 * Cleansing Gel.
 * Repulsion Gel Test Chambers 01, 02, and 03.
 * Pump Station Beta.

Co-op
The co-op campaign is set after the events of Portal 2's single-player campaign. In it, the two testing androids Atlas and P-Body of the Cooperative Testing Initiative carry out a series of tests in six different courses, each consisting of about eight or nine chambers. At the end of each course, GLaDOS sends the androids outside of the testing chambers and into the facility itself, claiming their help is needed to retrieve several Compact Discs "innocently" left lying around by the humans. In reality, she appears to be using the androids to help her gain control of the facility and gain information on "Area 219.32". After each out-of-chamber task, both androids are self-destructed and then reassembled in the Hub.

Calibration Chamber
The initial cooperative course whose main purpose is to 'calibrate' Atlas and P-body for each other, as well as their own controls. During this course, GLaDOS implies the idea that most of this course is a competition of who is faster, as well as initiating her general attitude of creating friction between the two.

Course 5: Mobility Gels
With the previous courses finished, GLaDOS can now access a vault in the lower levels which contains hundreds of human test subjects. She has determined that, given their inability to die, Atlas and P-body just aren't the same as human test subjects. They are sent to open the vault. These final chambers take elements from all the previous test courses while adding the Aperture Science Mobility Gels as an additional element. In particular, the creative use of Hard Light Bridges and Excursion Funnels in conjunction with the gels is a necessary aspect of completing the test. Upon reaching the vault, ATLAS and P-body open it by making similar gestures to the camera installed on the lock. GLaDOS claims to have more work for them as she destroys them. As the credits roll, GLaDOS scans the identities of the test subjects and makes remarks about them, both positive and negative, though in the end the comments are apparently all directed at one subject.

Course 6: Art Therapy
GLaDOS rebuilds Atlas and P-Body, claiming that 100,000 years have passed since the conclusion of the 'Mobility Gels' course. She also claims (unconvincingly) that all of the humans are still alive. She guides the two of them through a new set of courses (which are supposedly designed to be art exhibitions), though a number of mechanical failures occur, which GLaDOS attempts to cover up.

At the end of Portal 2 Co-op Course 6 Chamber 4, the disassembly machinery fails, forcing ATLAS and P-body to make a detour through an incomplete test track. GLaDOS admits that she has been lying and reverses her original claim of the humans being fine, revealing that she has already killed them all during testing. She also comes clean that it has only been a week since the humans were "rescued," not 100,000 years.

GLaDOS believes that Chell has returned and has gained control of an old mainframe chassis, posing a threat to the facility. ATLAS and P-body spend the remaining chambers being "trained" as killing machines, though this merely involves solving further tests and being plied with generic insults. In the final chamber, GLaDOS informs the two that the reassembly machines have broken down and that if she doesn't regain control, their next deaths will be permanent.

The robots reach the chassis, but find that it is being controlled mindlessly by a crow nesting. Despite GLaDOS' calls for a retreat (due to her phobia of birds following her experiences as a potato), ATLAS gets the bird from the control panel and P-body manages to lock it out of the facility. GLaDOS then notices that the crow had been harboring three eggs, which she hatches in an "oviparous warming vault," planning to breed the chicks as "little killing machines". This reinforces speculation of using birds as test subjects as seen in Portal.

Trivia

 * In order to flesh out the story in Portal 2, Valve originally intended to include an exhibition within the Aperture Science facility, one composed of different dioramas showcasing various aspects of the company and its philosophy. The dioramas were ultimately cut before the final release due to pacing issues and the Cave Johnson voice lines have replaced that level so the player can solve Test Chambers while also getting to know more about the old Aperture Science chambers and trivia.