Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 63

Testing the Deployed Application

Recommended resources

Hello! Congratulations on reaching the final lesson of your course. This is a massive achievement. You have journeyed from writing your very first line of Python code to building a full-stack web application and deploying it to the live internet.

In our last lesson, you learned the critical skill of monitoring deployment logs to confirm that your application has started correctly on the server. Now that you know your app is running, it's time for the final, crucial step: ensuring it's working as intended for a real user.

This lesson will guide you through performing a final, comprehensive test of your live application. We will cover how to systematically check its features, test for common problems, and verify that the user experience is solid. By the end, you will have the confidence that your deployed project is complete and ready to be shared.

Why is Final Testing Important?

Up until now, you've been testing your application on your own computer in a "development" environment. A live "production" environment can sometimes behave differently. Final testing is the quality assurance step where you act like a user and verify that everything functions correctly in the real world. It's your last chance to catch bugs, fix usability issues, and polish the application before sharing it with others.

There are many ways to think about testing. For our purposes, we can group our tests into a few simple categories.

DIY Quality Assurance Checklist For Your Web Application

This article provides an excellent, non-technical overview of different types of testing you can perform on a web application. We won't go into all of them, but understanding the categories will help you think systematically about your own testing.

Read the introductory section titled Types of Quality Testing That You Can Implement At Your End. Then, focus on the descriptions for the following types: #1 User Testing: Focuses on visual appearance and ease of use. #5 Responsive Testing: Checks if the site works on different screen sizes, like mobile phones. #7 Form Testing: Verifies that your input forms work correctly. Skim the 'Website QA checklist' at the end to see how these concepts are summarized.

As you can see, testing isn't just about seeing if the code runs without crashing. It's also about ensuring the application is usable, looks right, and works well for everyone, no matter their device.


Your Final Testing Checklist

Let's create a specific checklist for your text analysis application. We will test it in three phases: the "happy path" (when everything is done correctly), edge cases (unexpected inputs), and responsiveness.

For all these tests, you should have your application's live URL open in your browser.

Deployed Flask Application on PythonAnywhere
Your live application, like the example shown here, is ready for testing. You will interact with this live version, not your local one.

1. The "Happy Path" Test

The "happy path" refers to testing the application's core functionality with normal, expected user behavior. The goal is to confirm that the app does what it's supposed to do when used as intended.

Watch how this presenter demonstrates the core features of his deployed application. This is a perfect example of a "happy path" test.

Deploy Python Flask App on Pythonanywhere.com

In this video, after deploying his application, the creator walks through its main features to confirm everything is working on the live server. This is exactly what we mean by 'happy path' testing.

Watch from 04:50 to 07:37. Notice how he tests user registration, login, making a deposit, and downloading a report—all the core functions of his app.

Now, let's do the same for your application. Go through these steps:

Functional Checklist:

  • Load the page: Does your web application's main page load without any visible errors?
  • Enter Text: Can you type a normal paragraph (e.g., 3-4 sentences) into the main text area?
  • Perform Basic Analysis (Word Count): Click the button for your word/character count feature. Does the correct count appear on the page?
  • Perform AI Analysis (Summarization/Grammar):
    • Click the button for one of your Gemini API features (e.g., "Summarize").
    • Does a loading indicator appear to show the user that something is happening?
    • After a few seconds, does the AI-generated result replace the loading indicator?
    • Is the result sensible and correctly formatted?
  • Test Other Features: Repeat the process for any other AI or analysis features you built.
  • Copy to Clipboard: If you implemented a "copy" button, does it successfully copy the generated text?

If you can check off all these boxes, it's a great sign! Your application's core functionality is working in the live environment.

2. Edge Case and Error Testing

Users don't always follow the happy path. They make mistakes or do unexpected things. A robust application should handle these "edge cases" gracefully instead of crashing.

Edge Case Checklist:

  • Empty Input: What happens if you click a submission button without typing any text in the text area?
    • Good: The app shows a user-friendly message like "Please enter some text."
    • Bad: The app crashes, shows a cryptic error, or sends a request that gets stuck.
  • Very Long Input: Copy and paste a very large amount of text (e.g., a few pages from a document) into the text area and submit it. Does the application handle it, or does it time out or crash? (Note: It might be slow, which is okay for now, but it shouldn't break).
  • Rapid Clicks: Click one of the submission buttons multiple times in a row, very quickly. Does the app handle this gracefully, or does it send many duplicate requests and behave strangely?
  • Invalid API Key (Simulated): In your Render dashboard, go to "Environment" and temporarily change one character in your GEMINI_API_KEY. Save the changes, which will trigger a redeploy. Now, try to use an AI feature. Does your application show a user-friendly error message (e.g., "Could not connect to the AI service"), or does it crash with an "Internal Server Error"? (Remember to change the key back afterward!)
Test your understanding!

You test the "empty input" case and your live application crashes, showing an "Internal Server Error" page. Based on the previous lesson, what is your debugging process?

Show answer
  1. Go to your service's dashboard on Render.
  2. Open the Logs.
  3. Filter for level:error to find the Python traceback.
  4. Read the error to understand the cause (e.g., you might be trying to process a None value).
  5. Fix the code on your local machine (e.g., add an if statement to check if the input is empty).
  6. Push the fix to your GitHub repository.
  7. Wait for the new deployment to go live, then test the empty input case again to confirm it's fixed.

3. Responsive and Cross-Browser Testing

Your application should be usable for everyone, not just people with the same screen size and browser as you.

  • Cross-Browser Testing: If you use Chrome, try opening your app's URL in Firefox or Microsoft Edge. Do all the elements look and work the same? Sometimes, minor styling issues can appear between browsers.

  • Responsive Testing: You need to check how your app looks on a mobile phone. You don't need a physical phone to do this; you can simulate one in your browser!

    1. In Chrome or Firefox, right-click anywhere on your page and select Inspect.
    2. In the developer tools panel that opens, look for an icon that looks like a phone and a tablet (Toggle device toolbar). Click it.
    3. Your page will now be shown inside a frame that simulates a mobile screen. You can choose different devices like "iPhone 12 Pro" or "Pixel 5" from a dropdown menu at the top.

Check your application in this mobile view. Is the text readable? Are the buttons easy to click? Does any content overflow off the screen? If you used a CSS framework or Flexbox as planned, it should adapt reasonably well.


The Debugging and Redeployment Cycle

If you find a bug during your testing, you now have a complete workflow to fix it.

Deploy Python app to PythonAnywhere

This clip perfectly demonstrates the complete test-fail-fix-redeploy cycle. The presenter makes a code change, reloads the app, sees an error, checks the logs to identify it, fixes the syntax error, and reloads again to confirm the fix.

Watch from 08:27 to 10:46. This process of finding an error on the live site and using the logs to fix it is a fundamental skill you will use throughout your programming journey.

The cycle is always the same:

  1. Test the live application and find a bug.
  2. Check the logs (browser console for frontend, Render logs for backend) to diagnose the error.
  3. Fix the code on your local machine.
  4. Commit and Push the fix to GitHub.
  5. Wait for Render to auto-deploy the change.
  6. Retest the live application to confirm the bug is gone.

Conclusion and Course Wrap-Up

Congratulations! You have completed the course.

You have successfully built a web application from scratch, connected it to a powerful AI model, and deployed it for the world to see. You've also learned the essential, practical skills needed to test and maintain a live project.

Key Takeaways from this Lesson:

  • Final testing is a critical step to ensure your deployed application works correctly from a user's perspective.
  • The "happy path" test verifies the core functionality with expected inputs.
  • Testing for edge cases and invalid inputs makes your application more robust and user-friendly.
  • Responsive and cross-browser testing ensures your app is accessible to a wider audience.
  • When you find a bug, you now have a complete workflow: identify, diagnose with logs, fix locally, and redeploy.

You started this journey as a complete beginner with a goal to build a web application. You've now turned that goal into a reality. You should be incredibly proud of what you've accomplished. This project is a testament to your dedication and a fantastic piece to build upon for your portfolio.

From here, you can continue to add features, refine the user interface, or start a brand new project using the solid foundation of skills you've built. The journey of a developer is one of continuous learning, and you have taken the most important first steps. Well done