How to set up unit testing for a simple solution

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

How to set up unit testing for a simple solution

Postby 258.d.852 » Mon Jan 15, 2024 12:29 pm

Dear Servoy community,

I would like to test my Servoy-solution, then I do the following steps

    1. Create a soltuion, let's call my_solution_test
    2. In the scopes, I defined a new scope call, test_Service
    3. In the test_Service scope, I simply implemented the following logic

Code: Select all
function should_return_true() {
    jsunit.assertTrue(true);
}


    4. Execute the test by right-click on the solution, then choose the option: Run JS Unit Test(s)

I got the following error:
AssertionFailedError: The selection does not have jsunit tests. (JsUnit.js#691)


Could you please help me out?

Thanks
258.d.852
 
Posts: 10
Joined: Wed Jul 12, 2023 1:10 pm

Re: How to set up unit testing for a simple solution

Postby patrick » Mon Jan 15, 2024 12:37 pm

Your method name needs to start with "test_". Have a look at this to help you get started:

https://wiki.servoy.com/display/Serv7/Unit+Testing
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: How to set up unit testing for a simple solution

Postby 258.d.852 » Mon Jan 15, 2024 2:13 pm

Thanks for your quick help!
258.d.852
 
Posts: 10
Joined: Wed Jul 12, 2023 1:10 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 25 guests