TestProject is now better than ever

When I meet someone who I haven’t met before, and we get talking about what each of us does for a living. After getting past the explanation of what software testers do (hint: It’s not breaking software). I like to drop in some details about my work with automation and how I work with tools to enable applications to perform predefined actions.

Usually, this gets reaction that you are probably thinking, and they say something like: ‘Wow, I wish I could do that!’

But the thing is, they can if they really wanted to. As much as automation engineers like to think we have unique abilities and can make the DOM submit to our every need. Test automation isn’t complex in the slightest.

Back when I first started, I had no other option than to start learning a programming language (which first started off as being Perl, then Python and finally C# and Java). As well being familiar with a framework like Selenium or Robot Framework. Nowadays however with advancements in technology and the availability of newer and better tools. The barrier to entry has come way down and now anyone with a passion to apply test automation to a new or existing project. Only needs to do a bit of learning and they can jump right in and start reaping the rewards almost immediately.

One tool that I routinely use and recommend to people who are interested in implementing test automation is the free cloud-based testing solution TestProject. I have previously blogged about my thoughts on TestProject and was lucky enough to have had an article posted over on their blog. The standout feature that I love about TestProject is the fact that the tests run on top of the frameworks (Selenium and Appium) which we all use daily and know like the back of our hands… almost.

With the provided SDK. Testers and developers can effortlessly collaborate and execute Selenium and Appium native tests on a single automation platform with no complex setup, maintenance or configurations needed. Previously, the SDK only provided support for C# and Java programming languages, but recently (this week in fact!) a new version has been released with support for Python as well as containing support for new capabilities that further evolve the test automation platform. This makes TestProject the first free automation solution to support Java, C# and Python for applications covering both web and mobile.

Constructing your first Python Test

Lets take this puppy for a spin!

Before writing your test, there’s a few steps that you must perform first.

Let’s do a simple test case to show the basic functionality that the SDK allows you to do. You can extend this to implement complex logic. But I’ll show you the basics and you can go from there.

This test case will navigate to Docket, ensure the page is loaded and displaying the right header text. Then return a pass/fail.

If you are using pip, then the SDK can be installed via pip install testproject-python-sdk. However, I would recommend and advocate that you make use of virtual environments with a tool like pipenv which allows you to avoid installing things globally (you can read more about pipenv here).

Next, fire up your favourite Python editor and paste in the below code.

from src.testproject.sdk.drivers import webdriver

def docket_test():
driver = webdriver.Chrome()
driver.get("https://docket-test.herokuapp.com/")
header = driver.find_element_by_class_name('intro-text').is_displayed()
print("Test passed") if header else print("Test failed")
driver.quit()
if __name__ == "__main__":
docket_test()

Note: You’ll need to make sure you have your token available through an environment variable, or you can simply use :

    driver = webdriver.Chrome(token='<token here>')

You should see a Chrome window display, run our test and then your terminal display ‘Test Passed’. Congrats, you have run your first TestProject test with the Python SDK!

TestProject also supports unit testing libraries such as pytest and unittest making it simple to integrate Python TestProject tests into your existing workflow.

Reporting

A key addition to automated testing efforts and one that can be tricky to setup is report generation capabilities. Not only is that ability key to showing others how you testing is performing over time, but it is also a highly valuable assets to meassure how your testing is performs over multiple days, weeks, and even months.

Luckily, TestProject takes care of this for us, and we simply need to log into our account to have easy access to beautiful reports in HTML or PDF file formats.

test_project_reporting

If you ran the sample test case above. Head over to the Reports section on the TestProject website and you’ll see an extra project listed named ‘unnamed project’. From there, you’ll be able to see all the test cases in the project and various statistics that you can download, file away, or do anything with that your heart desires.

Summary

Python may not be my first programming language, or even the one I get to use the most. But It’s one that I have a strong fondness for and enjoy working with. Being able to now use Python with TestProject is something that has made making use of the platform even more attractive to me.

Being able to code and execute tests locally and remotely with no added complexity. Have access to detailed and robust reporting and being able to integrate my tests with frameworks like pytest mean that this new evolution of the platform is one that is warmly received by this tester and I’m sure by many others too.

What do you think of the latest update to the TestProject SDK? Let me know in the comments below. Or contact me on Linkedin or Twitter.

Posted by Kevin Tuck

Kevin Tuck is an ISTQB qualified software tester with nearly a decade of professional experience. Well versed in creating versatile and effective testing strategies. He offers a variety of collaborative software testing services. From managing your testing strategy, creating valuable automation assets, or serving as an additional resource.

Leave a Reply