Fundamentals 21 min read

Key Differences Between B/S & C/S, Cookie vs Session, and Essential Software Testing Techniques

This article explains the architectural distinctions between B/S and C/S models, compares cookies and sessions, outlines the purpose of testing, and provides practical test case designs for pens, triangles, shopping carts, databases, UI automation, weak‑network scenarios, and Python coding examples, offering a comprehensive guide for software testing fundamentals.

Software Development Quality
Software Development Quality
Software Development Quality
Key Differences Between B/S & C/S, Cookie vs Session, and Essential Software Testing Techniques

1. Differences between B/S and C/S architectures

1) Architecture: B/S is browser/server, C/S is client/server. 2) Client: B/S uses a browser, C/S uses a client program. 3) Function: B/S mainly for web services, C/S for application services. 4) Maintenance: B/S maintenance is server‑side, C/S maintenance involves both client and server. 5) Security: B/S generally has lower security, C/S higher security.

2. Differences between Cookie and Session

1) Cookie data is stored in the client’s browser, Session data resides on the server. 2) Cookie is less secure and can be forged; Session is more secure with server‑side encryption. 3) Cookie can set an expiration time; Session persists until its timeout expires. 4) Cookie stores client‑side information, while Session stores server‑side information.

3. Purpose of testing

Testing ensures that software systems operate as expected and meet user requirements.

4. Testing a ballpoint pen

1) Writing quality – tip fineness, ink flow, color, durability. 2) Appearance – body, ink cartridge, cap. 3) Craftsmanship – installation, removal, replacement of the cartridge. 4) Functional performance – tip precision, ink flow, durability. 5) Safety performance – cartridge safety, wear resistance, corrosion resistance.

5. Triangle test case design

1) Input three side lengths to verify a triangle can be formed. 2) Verify formation of an equilateral triangle. 3) Verify formation of an isosceles triangle. 4) Verify formation of a right‑angled triangle. 5) Verify formation of an obtuse triangle.

6. Classic bugs found in projects

1) Null‑pointer exceptions. 2) Out‑of‑bounds access. 3) Memory leaks.

7. How to quickly locate bugs in software

1) Understand the software’s functionality and architecture. 2) Exercise different features to spot anomalies. 3) Use varied input data to test handling. 4) Leverage built‑in automated test features. 5) Use debugging tools to trace execution. 6) Apply memory debuggers for leak detection. 7) Use performance profilers for bottlenecks. 8) Run security scanners for vulnerabilities. 9) Employ static code analysis for code errors.

8. How to test search functionality

Functional tests: verify accurate results for single characters, words, sentences, and correct links. Length tests: test boundary lengths (e.g., 100 vs 101 characters). Character type tests: numbers, letters, Chinese characters, special symbols. Whitespace handling: trim leading/trailing spaces, preserve internal spaces. Full‑width/half‑width character handling.

9. Test cases for Taobao shopping cart

1) Verify page layout after opening Taobao. 2) Check visibility of functional buttons. 3) Ensure “Add to cart” appears on product pages. 4) Confirm selected items can be added to the cart. 5) Validate that all product information displays after adding. 6) Test removal of items from the cart. 7) Verify cart addition works under poor or no network conditions. 8) Check quantity increment when clicking the plus button. 9) Check quantity decrement when clicking the minus button. 10) Ensure a warning appears when quantity reaches the minimum limit. 11) Prompt login when adding to cart while not logged in. 12) Prompt “please add items to checkout” when no items are selected. 13) Display total price of selected items. 14) Verify total price calculation accuracy. 15) Navigate to order confirmation page after checkout. 16) Confirm total price on the confirmation page. 17) Detect precision errors in total price display. 18) Allow editing of product attributes. 19) Support moving the page to the top. 20) Enable editing of product specifications in the cart. 21) Restrict quantity exceeding stock. 22) Allow clearing the cart. 23) Ensure total amount updates with quantity changes. 24) Handle app crashes after excessive refreshes. 25) Continue running when a phone call arrives. 26) Remain responsive under low memory conditions.

10. Database join types

Inner join, outer join, left outer join, right outer join, full outer join. Differences: outer join’s “OUTER” keyword is optional; inner join returns rows meeting the join condition, outer joins also return non‑matching rows; left/right outer joins return all rows from the left/right table respectively; full outer join returns all rows from both tables.

11. Common UI automation element locating methods

1) id定位
find_element_by_id("")
2) name定位
find_element_by_name("")
3) class定位
find_element_by_class_name("")
4) tag定位
find_element_by_tag_name("")
5) link定位
find_element_by_link_text("")
6) partial link定位
find_element_by_partial_link_text("")
7) XPath定位 (most common)
   - absolute path: find_element_by_xpath("/html/body/...")
   - attribute based: find_element_by_xpath("//input[@id='...']")
   - hierarchy based: find_element_by_xpath("//div[@class='...']/table/...")
   - logical operators: find_element_by_xpath("//input[@id='...' and @name='...']")
   - contains: find_element_by_xpath("//classname[contains(@classname,'name')]")
   - starts‑with / ends‑with, text(), etc.
8) CSS selector定位
find_element_by_css_selector(".class")
find_element_by_css_selector("#id")
find_element_by_css_selector("div")
find_element_by_css_selector("[name='...']")
find_element_by_css_selector("td > div")

12. Difference between close() and quit()

close() closes the current window; quit() shuts down the driver and closes all windows, releasing memory.

13. Reasons an element cannot be located in automation

1) Incorrect element locator. 2) Randomly generated IDs. 3) Non‑unique attributes. 4) Need to switch to the correct iframe. 5) Locators containing spaces. 6) Using absolute XPaths that break with DOM changes. 7) Missing or insufficient wait times. 8) Element is hidden.

14. Common automation testing tools

1) Selenium – open‑source web testing. 2) Appium – cross‑platform mobile testing (iOS, Android, Firefox OS). 3) Watir – Ruby‑based web testing. 4) TestComplete – commercial tool for Windows, web, mobile, desktop. 5) QTP (QuickTest Professional) – commercial tool for Windows, web, mobile, desktop.

15. How to perform weak‑network testing

1) Analyze user network environment (bandwidth, latency, packet loss). 2) Set up a test environment that simulates those conditions. 3) Execute tests to verify functionality and performance under degraded networks. 4) Analyze results to determine if the software meets requirements.

16. Keyword‑driven vs data‑driven testing

Keyword‑driven testing uses a series of keywords to control test execution and is simpler to write; data‑driven testing drives execution from external data files, allowing easier parameterization and maintainability.

17. What is a decorator and its purpose

A decorator is a special function that adds extra functionality to another function without modifying its code, making the code more concise and elegant.

18. Getting all keys from a Python dictionary

dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
keys = dict.keys()
print(keys)  # Output: dict_keys(['Name', 'Age', 'Class'])

19. Checking Linux server load

Use the top command to view real‑time CPU, memory, and process usage, or the uptime command to see system uptime, user count, and load averages.

20. Python program for the multiplication table

for i in range(1, 10):
    for j in range(1, i+1):
        print(f"{i}x{j}={i*j}\t", end='')
    print()
# Output:
# 1x1=1
# 2x1=2 2x2=4
# 3x1=3 3x2=6 3x3=9
# ... up to 9x9=81
automationsoftware testing
Software Development Quality
Written by

Software Development Quality

Discussions on software development quality, R&D efficiency, high availability, technical quality, quality systems, assurance, architecture design, tool platforms, test development, continuous delivery, continuous testing, etc. Contact me with any article questions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.