iammuhit / software-testinng-assignments

For students to download code from

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1DL610-HT23-coding-assignments-students

For students to download code from

Instructions for Lab 1:

This lab session is meant for those who may not have had experience with Python, PyCharm, pytest or git to get you up to speed. It is an ungraded Lab session.

Please install PyCharm, pytest and git on your computer if possible before the lab.

During the lab session:

  1. Installation of Software if you haven't done it already
  2. Python tasks to help you learn the main features of the language

1. The resources to download/get started with the software: Pycharm:

Installation and Setup - PyCharm Guide (jetbrains.com)Links to an external site.

Install PyCharm | PyCharm Documentation (jetbrains.com)Links to an external site.

Pytest:

Pytest | PyCharm Documentation (jetbrains.com)Links to an external site.

pytest: helps you write better programs — pytest documentationLinks to an external site.

Git:

Set up a Git repository | PyCharm Documentation (jetbrains.com)Links to an external site.

How to Install Git on PyCharm? - Be on the Right Side of Change (finxter.com)Links to an external site.

How to Use Git and GitHub – Introduction for Beginners (freecodecamp.org)Links to an external site.

2. Here are some tasks to get started with Pycharm, Pytest and Git: Tasks:

  1. Write a simple Python script to input text from a user and print it. Hint: Here you can use input() function to collect user input and print().

  2. Write a Python script that takes two values as input, checks if they are integers, and prints their sum if they are both integers or "Incorrect input" if not.

  3. Write a function which returns different values based on the data type of input given to it. Hint: You can give any type of data, value1= number, value2= text, etc…

  4. Write a function which accepts a string (s) and an integer (x) as a value and returns a value that is that string s for x number of times.

  5. Write a function which searches a dictionary for the key "source" and retrieves its value. Handle the exception for the error using the KeyError exception.

  6. Write a function that iterates over a string in two ways: a. Converting the string to a list and iterating over the index by calculating its length and b. Parsing the string itself with the for loop.

  7. Write a function that uses regular expressions to check whether a given string is in the email format or not. Hint: Username part of the email can have letters (both lowercase and uppercase), Digits (0-9) and special characters (-,_, %, +). Domain part can have letters (both lowercase and uppercase), Digits (0-9), the dot (.) and hyphen (-). TLD part of the email should contain at least 3 letters. (Eg: .com, .org)

  8. Write a function that returns the number of words in a string separated by spaces. Check this with two pytest tests: one that uses the input "Hello World" and passes if the return value is 2 and another that fails the same case.

Download the Software and work on the Task mentioned above, in case of any questions you can ask the TAs during the Lab session. Good Luck!

About

For students to download code from

License:MIT License


Languages

Language:Python 98.7%Language:Dockerfile 1.3%