DEV Community

Ronald R
Ronald R

Posted on

Automated Testng

For this lab we had to create a CI that would basically run the tests when we push into the repository after we requested a Pull Request. Seemed straight forward enough right? WRONG, for someone who is unfamilliar with CI, I had no clue where to start luckily I had our professor guide us how to do it.

So I started with implementation of the tests, I'll be honest It was quite trouble some because when I created the yaml file I did it manually and when I tried pushing it the first time it was giving me error Closed PR for CI testing as you can see right here. it was because the yaml file I had was different and was failing for some reason. so I had to re do the entire thing all over again.

I had to close the file, and requested another PR jsut to ensure it was done crrectly. I tried the github actions congifuration python for the workflow and it included all the things I needed. which also included flake8 which is my linter program which was convient enough since we had to implement an optional linter test test.

This is the main PR that I did, I was a bit sad because I was not able to implement my automatic failure test code because it was failling, maybe i should have merged it still but I did not want to make such a hassle for anyone else working on my repo. luckily it worked well with my lab because it was required for us to purposely fail a program which luckily enough it did and I was able to finish the first part of the testing.

For the second part this is where it got interesting. I tried working on like 3 repository and had their own issue. 1 was not properly set up and I tried eveyrthing I could to run it and it was still not working, I used 2 different machines and was not able to make it work, so I had to just move on. Next I worked on program but the CI wasnt set up yet, thinking to myself, I could make one for this repo but that means me doing their work for them, so I moved on again.

The third repository I worked for was a godsend, it had its own problem but was really manageable, I spoke with the owner of the repo and was appreciative enough to communicate with me to run the program properly, It was running all the tests without actually calling anything specific and, even if we did call in a specifi unittest to run it will still run everything. I reviewed te file and saw that there was a missng module in the tests folder which was a innit.py file tobe able to import the package or take import from otherm odule properly.

After implementing this module we were able to run the unittest individually, I created a simple unittest to test the argument passer of -v or -version. It was a simple code but it showed the functionality of the program and by implementin that init.py we were able to run the program properly.

All in all this lab was very helpful as it was interesting to learn CI and unittest as those are the things that I truly wanted to learn from the get go. Maybe to make things easier i should just work on pycharm but let's see. ON TO THE NEXT AND FINAL LAB!

Top comments (0)