whatsplay / whatsapp-play

Command line software through which you can play with your WhatsApp. It is having different options to play with your WhatsApp like message blast, online tracking, whatsapp chat..
MIT License
405 stars 217 forks source link

#102 Automated unit test case written successfully for kill_child_process.py #264

Closed SinghHimadri closed 4 years ago

SinghHimadri commented 4 years ago

102

Closes: # (issue number)

Proposed changes

Successful test added for kill_chil_process Brief description of what is fixed or changed To create a child process subprocess library has been used a function get_test_subprocess() which does nothing for 30 sec has been written. This test works in all MACOS, WINDOWS, and Linux. Since this test deals with os part all care has been taken and os.fork had many limitations so subprocess is used. The logic for the test is a child is created its process id is stored then this child process is killed using kill_child_process function and then checks is this id still exists in our os using psutil.pid_exists(test_pid) we self assert false. As the process is killed so it returns false and we assert it.

Types of changes

A test folder has been added. This folder contains test_kill_child_processes and test_func which contains a function that creates child process which does nothing for the next 30 sec. Put an x in the boxes that apply

Checklist

Put an x in the boxes that apply

Screenshots

I have written the test that works successfully and the function passes the test i.e. used kill_child_process function used. I am sharing results.Attaching screenshots Screenshot from 2020-03-30 15-39-10

Please attach the screenshots of the changes made in case of a change in user interface

Other information

I would request to not unassign me or close this issue since this is the first automated unit test added. I am writing more tests and will be sending their PR soon. Also, I haven't updated documentation because more tests are to be added. I'll update once all test cases are added. Any other information that is important to this pull request

SinghHimadri commented 4 years ago

The test is running successfully I don't think there are any issues. Please review @rpotter12 @xandao6

priyansh19 commented 4 years ago

Hi @SinghHimadri Please check your Pr there is increased complexity with your files

Do resolve them and update your PR :+1:

xandao-dev commented 4 years ago

Changed to medium difficulty because just solve one of the many possible tests.

priyansh19 commented 4 years ago

@SinghHimadri add them in the test folder and work on further tests :+1: @xandao6 She will be adding more test cases in the future.

rpotter12 commented 4 years ago

Codacy Here is an overview of what got changed by this pull request:


Issues
======
- Added 5

Complexity increasing per file
==============================
- tests/test_func.py  7
- tests/test_kill_child_process.py  1

See the complete overview on Codacy

SinghHimadri commented 4 years ago

@SinghHimadri add these in test folder

Change done.

SinghHimadri commented 4 years ago

LGTM.....I have not tested it yet.

I have added command for running tests in test_kill_chil_process. You can test it 🙂