Method for testing a computer program programmed in an object-oriented scripting language, and system, computer program and computer-readable storage medium

EP4609292A1Pending Publication Date: 2025-09-03VOLKSWAGEN AG
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
EP2023790262
Authority / Receiving Office
EP · EP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2022-10-24
Filing Date
2023-10-12
Publication Date
2025-09-03

AI Technical Summary

Technical Problem

Scripting languages without compilation fail to detect errors until runtime, lacking the fail-safe error detection of compiled programming languages, which can lead to errors occurring late in execution, especially in critical applications like autonomous vehicle control.

Method used

A method for testing computer programs in object-oriented scripting languages by generating abstract classes, comparing properties of non-abstract members with abstract members, and outputting errors if mismatches are found, utilizing libraries like Python's 'abc' for improved error detection and loose coupling between software components.

Benefits of technology

This approach enables early detection of errors, making the computer program more fail-safe, efficient, and reliable, similar to compiled languages, while maintaining the advantages of scripting languages, and ensures safer operation of autonomous systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 1.1
    Figure 1.1
Patent Text Reader

Abstract

The invention relates to a method for testing a computer program programmed in an object-oriented scripting language, comprising the following steps: - providing a computer program part for generating abstract classes (2); - providing at least one abstract class (2), which comprises at least one abstract member (3, 4), by means of the computer program part; - providing a class (9) which inherits from the abstract class (2) and which comprises only non-abstract members (10, 11); - generating an object derived from the inheriting class (9), the object therefore constituting a reference to the abstract class (9), - wherein properties of the non-abstract members (10, 11) are compared with the properties of the abstract members (3, 4); and - if there is at least one abstract member (3, 4) of the abstract class (2) for which no non-abstract member (10, 11) of the inheriting class (9) having the same properties is found, an entry is generated in an error list and said error list is then output as an error message.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Description

[0002] Method for testing a computer program programmed in an object-oriented scripting language, as well as system, computer program and computer-readable storage medium

[0003] One aspect of the invention relates to a method for testing a computer program programmed in an object-oriented scripting language.

[0004] Object-oriented programming languages ​​are known that work with the concept of an interface and dependency injection. Interfaces are abstract classes that contain only abstract methods and abstract attributes. These programming languages ​​have a compiler that compiles written program code before it is executed. The program code is checked for errors and translated into machine code. The compiler checks at compile time whether all interfaces and assignments within a program are consistent. This ensures that programs based on compiled program code run reliably, as errors are detected before execution.

[0005] With scripting languages ​​that aren't compiled, errors only occur at runtime. However, scripting languages ​​offer other advantages over compiled programming languages.

[0006] Therefore, the object of the invention is to enable advantages of compiled programming languages ​​for scripting languages.

[0007] The problem is solved by the subject matter of the independent patent claims. Advantageous developments of the invention are described by the dependent patent claims, the following description, and the figure.

[0008] One aspect of the invention relates to a method for testing a computer program programmed in an object-oriented scripting language, preferably comprising the following steps: providing a computer program part for generating abstract classes; providing at least one abstract class, which has at least one abstract member, in particular only abstract members, by means of the computer program part;

[0009] Providing a class that inherits from the abstract class and has only non-abstract members;

[0010] Creating an object derived from the inheriting class, whereby this object represents a reference to the abstract class, comparing properties of the non-abstract members of the inheriting class with the properties of the abstract members of the abstract class; and if there is at least one abstract member of the abstract class for which no non-abstract member of the inheriting class with the same properties is found, an entry is created in an error list and this entry is then output as an error message.

[0011] In particular, the proposed method can be a computer-implemented method. In particular, the method is executed on an electronic computing unit. The tested computer program can be executed on this computing unit or, after transfer, on another computing unit. By executing the computer program, a vehicle can be controlled, in particular autonomously, in particular semi-autonomously. If appropriate, it is a method for operating an electronic computing unit. In particular, the method also improves the operation of a computing unit. In particular because the computing unit can thus operate with fewer errors and, in particular, thus also more quickly and efficiently. In particular, the execution of a computer program on a computing unit is improved. A method for executing a computer program on a computing unit is therefore also provided.

[0012] In particular, these are scripting languages ​​that do not have built-in type checking and / or interface definition.

[0013] The newly and additionally provided computer program component for generating abstract classes is not necessarily part of the computer program. However, it can be added to the computer program. The computer program component can also be integrated into the computer program as a library. If the chosen programming language is Python, for example, the Abstract Base Class (abc) library can be integrated for this purpose. At least the computer program component now makes it possible to perform the aforementioned steps and thus improve a conventional computer program programmed in an object-oriented scripting language with regard to error generation and error detection.Thus, it is now possible to use such computer programs with their advantages compared to compiler-based computer programs and still offer the better analysis capability with regard to error detection that is available in compiler-based computer programs.

[0014] In object-oriented programming, abstract classes are classes that have at least one abstract method or at least one abstract attribute. Methods and attributes of a class can be referred to as members of the class. Interfaces are a special case of abstract classes. They normally only have abstract members, which means, for example, they only have abstract methods and abstract attributes. An interface can be understood as a contract that describes which members a class should have. In particular, an abstract member is a member that does not use an implementation, but only a definition, which can be referred to as a signature. For example, a class only becomes an abstract class if it has at least one abstract member. In general, an abstract class can also have non-abstract members. However, an interface usually does not.

[0015] In particular, an abstract class is provided, in particular programmed, in particular added to the computer program. In particular, some interfaces, in particular only interfaces, are provided. For this purpose, the computer program part is used in particular. Examples of a member type can be a method, an attribute, a class method, or a static method.

[0016] Example code for Python: from happy.typing import Abstractclass, abstractmethod, typechecked

[0017] # Definition of the interface class ITest(AbstractClass):

[0018] @abstractmethod

[0019] @typechecked def foo(self, value:int) -> str:

[0020] ©property

[0021] @abstractmethod def bar(self) -> float:

[0022] This example code can be used to provide an interface as a special case of an abstract class. Specifically, executing this example code creates an interface.

[0023] Non-abstract classes can inherit from abstract classes, especially from interfaces. All members of the abstract class must be implemented by the inheriting class, so that each abstract member of the abstract class corresponds to a non-abstract member of the inheriting class with the same properties, especially the same ones. A class can implement an interface by inheriting from it and overriding the corresponding members with a real implementation. A realization is, in particular, the concrete implementation of an interface. In particular, all previously abstract members must actually be implemented. A class can represent a realization of multiple interfaces.

[0024] Example code for Python:

[0025] # correct implementation that cTest(ITest):

[0026] @typechecked def foo(self, value:int) -> str:

[0027] ... # Implementation takes place here

[0028] ©property def bar(self) -> float:

[0029] ... # Implementation takes place here

[0030] An object can be derived from the inheriting class and created. This can be referred to as instantiation of the inheriting class. This gives the object a reference to the abstract class, in particular to the interface, from which the inheriting class inherits. In particular, a reference is a type of address by which an object can be accessed. In some programming languages, references can be represented directly as memory addresses. In Python, for example, this is not the case. When a class is instantiated, the object in particular is created in the memory of the computing unit, in particular a computer. In particular, this object is then passed on to functions or other classes in the form of a reference so that they can access it. In some cases, the memory address is not sufficient for access; additional information about the object in question is required.For example, it is necessary to pass the corresponding class of the object for access. Then it is possible to address the object correctly via the reference. According to the inventive method, the object represents the reference to the abstract class, in particular to the interface. Because the object's reference points to the abstract class, in particular the interface, it can be addressed externally via the methods and attributes of the interface. It is therefore particularly important that members of the interface are correctly and completely inherited, and in particular implemented, by the members of the inheriting class with regard to their properties. This makes it possible to achieve loose coupling between software components. A software component that uses an object of an inheriting class is only communicated with the bare minimum to use the object. Such a software component can be referred to as a client and the object as a service.A client, which can be another class or a function, can depend on the interface instead of a specific class. This allows the implementation to be replaced later with another class that implements the same interface. This creates loose coupling between classes. This allows the software code to be more modular and thus easier to maintain. Furthermore, the software code is easier to reuse, especially in different contexts.

[0031] Example code for Python: c = CT est()

[0032] In particular, the comparison of the properties of the abstract members with the properties of the non-abstract members is triggered by instantiation. In particular, the comparison is performed for all abstract members with all non-abstract members. In particular, the comparison is triggered by instantiation if another computer program component, in particular an integrated library, enables this. In particular, the comparison is not triggered without the other computer program component. In particular, the method checks whether an instance is even capable of implementing an interface.

[0033] This method is particularly advantageous because it enables or facilitates the use of common software engineering concepts such as dependency injection and numerous object-oriented patterns (oop patterns). In particular, the concept of using interfaces is fundamentally unknown in the Python programming language. Therefore, it is currently not possible to check whether an implementation is consistent and / or whether a passed reference is compatible with the interface.

[0034] If, for example, an error occurs during comparison, an entry is created in an error list. An error is detected, for example, if not all abstract members of the abstract class, in particular of the interface, can be assigned to a non-abstract member of the inheriting class. In this case, the error list in particular is output as an error message. Outputting the error list can mean that the error list is displayed to a user acoustically or visually, in particular on a screen. Alternatively or additionally, the error list can be output or made available to an external system. In particular, the error list contains information about which properties of which members do not match.

[0035] In one embodiment, the method comprises the following further steps: checking all objects referenced by a software component of the computer program to determine whether the respective referenced object represents a reference to the associated abstract class; and if at least one checked object referential to a software component does not represent the reference to the associated class, a further error message is output.

[0036] In particular, the associated abstract class is an expected abstract class, specifically one specified in the program code. In particular, for each function or method of the computer program, it must be checked whether the passed object references (passed object references) are instances of the expected abstract classes. If they are not, an error message may be issued, specifically to a user and / or made available to an external system.

[0037] This type checking can also be referred to as runtime type checking, as it occurs specifically at runtime and checks the type of the abstract class that contains a reference to the object. The type of the abstract class refers specifically to the name of the abstract class.

[0038] Example code in Python:

[0039] @typechecked def do_something(instance: Interface): instance. foo()

[0040] In particular, the check ensures that only objects from the expected class that implement an abstract class, especially an interface, can be passed as arguments to a function or method. In particular, it checks whether a reference can be formally assigned to an expected interface.

[0041] This embodiment ensures the consistency of the computer program, making it more fail-safe and less error-prone.

[0042] In one embodiment, the following properties of the members are compared: names of the members,

[0043] Type and data type of the respective member, and arguments of the respective member, and data type of the respective argument of the member, and data type of a return value,

[0044] For example, the type of a member indicates whether the member is an attribute or a method. When comparing the arguments of a member, the name and number of arguments of a method are particularly compared.

[0045] Arguments are, in particular, transfer parameters. In particular, the respective data type of the arguments is also compared.

[0046] In particular, all function decorators of the members are compared. In particular, a function decorator is a function that takes another function and extends the behavior of the latter function without explicitly changing it. In particular, a function decorator is a function that wraps another function. In particular, from the outside, it looks as if the actual function is being called, but the decorator is executed first, which then internally executes the actual function and then also returns its return value. If, for every abstract member of the abstract class, in particular of the interface, a non-abstract member of the inheriting class can be identified that matches an abstract member in all properties, then this comparison is successful.This ensures that the inheriting class is a correct implementation of the abstract class, especially the interface. This makes the computer program more resilient and less error-prone.

[0047] In one embodiment, an object is created for each inheriting class of the computer program, in particular for each inheriting class, before executing a main part of the computer program. A check is performed to determine whether the respective creation is successful.

[0048] In particular, this can be referred to as a module test or unit test. In particular, the creation of the object, which can also be referred to as instantiating the inheriting class, triggers a comparison of the properties of the abstract members with the properties of the non-abstract members. If the comparison is unsuccessful, the object cannot be created. In particular, an error message is then issued.

[0049] In particular, the unit tests, especially for all inheriting classes, can be created and / or executed automatically.

[0050] The main part can be defined as a part of the computer program that is, for example, executed permanently as long as the computer program is running.

[0051] In particular, code that is not part of the unit test is executed in the main part of the computer program.

[0052] Example code for Python: def test_create(self): instance = Class() assert isinstance(instance, Interface) assert isinstance(instance, Class)

[0053] The last two lines may not be necessary for the unit test. However, they increase the security and reliability of the consistency of the computer program. In particular, these two lines check whether the created instance is an instance of the inheriting class that implements an abstract class, specifically an interface.

[0054] In one embodiment, all software components of the computer program, in particular only, depend on abstract classes. The dependencies of the software components, in particular those that inherit from abstract classes, are generated and transferred centrally.

[0055] The advantageous development of this embodiment can be referred to as the introduction of dependencies (dependency injection). In object-oriented programming, dependency injection is a design pattern that regulates an object's dependencies at runtime. For example, if an object requires another object during its instantiation, this dependency is stored in a central location; it is not created by the initialized object itself. This central location can be referred to as the composition root. Specifically, "location" refers to a location in the computer program.

[0056] For example, it is possible for dependencies on other classes to be made available via constructors. This can be referred to as constructor dependency injection.

[0057] The composition root of the computer program is called directly after the program starts, especially before the main part of the computer program is executed. This ensures that dependencies are checked right at the beginning of the computer program. This allows all objects referenced by a software component of the computer program to be checked at this point to determine whether the respective referenced object contains a reference to the corresponding, particularly expected, abstract class.

[0058] This allows errors to be identified before the main part is executed. This also makes the computer program more reliable and less error-prone.

[0059] In one embodiment, the computer program is programmed and tested in the Python programming language. This programming language offers many advantages. In particular, it is considered a standard in the field of data science and machine learning. Specifically, Python 3 is used.

[0060] A further aspect of the invention relates to a method for executing a computer program. In this case, testing of the computer program is carried out before execution of a main part of the computer program. If an entry is made in the error list or an error message is output, execution of the main part is prevented. If no entry is made in the error list or an error message is output, the main part of the computer program is started, in particular automatically. Additionally or alternatively, the testing method according to the invention is carried out at least once during an already started execution of the main part, in particular when an object derived from an inheriting class is created.

[0061] If the main part is not executed due to an error, the error can be identified and corrected. In particular, the error is identified by the method according to the invention and automatically corrected by the external system.

[0062] In computer programs that are programmed in a scripting language, especially without a compiler, and are not tested using the method according to the invention, it is possible that errors only occur during the execution of the main part. This may not be the case until several hours later. The method according to the invention detects errors before the main part is executed. This saves time and energy, since no faulty program is executed for an unnecessarily long time.

[0063] The tested computer program can be used for the control of a vehicle, particularly autonomously, particularly semi-autonomously. The testing according to the invention increases the reliability of the computer program. This increased reliability can ensure safer operation of the vehicle.

[0064] A further aspect of the invention relates to a system for carrying out a method, comprising means for executing the steps of the method according to one of the preceding claims. The system can comprise an electronic test unit and / or an electronic computing unit. A further aspect of the invention relates to a computer program that is tested according to a method according to the above-mentioned aspect, in particular, that is loadable into a memory unit and executable by a processor.

[0065] A further aspect of the invention relates to a computer-readable storage medium comprising instructions which, when executed by a computer, cause the computer to carry out the steps of the method according to one of claims 1 to 7.

[0066] Further embodiments of the system according to the invention, the computer program according to the invention, and the storage medium according to the invention follow directly from the various embodiments of the method according to the invention, and vice versa. In particular, individual features and corresponding explanations as well as advantages relating to the various embodiments of the method according to the invention can be transferred analogously to corresponding embodiments of the system according to the invention, the computer program according to the invention, and the storage medium according to the invention. In particular, the system according to the invention, the computer program according to the invention, and the storage medium according to the invention are designed or programmed to carry out a method according to the invention. In particular, the system according to the invention, the computer program according to the invention, and the storage medium according to the invention carry out the method according to the invention.

[0067] The invention also includes combinations of the features of the described embodiments.

[0068] Exemplary embodiments of the invention are described below. Shown are:

[0069] Fig. 1 is a class diagram of an embodiment of a computer diagram;

[0070] The exemplary embodiments explained below are preferred exemplary embodiments of the invention. In the exemplary embodiments, the described components each represent individual, independently considered features of the invention, which also further develop the invention independently of one another and are thus also to be considered as components of the invention, either individually or in a combination other than that shown. Furthermore, the described exemplary embodiments can also be supplemented by further features of the invention already described.

[0071] In the figure, functionally identical elements are provided with the same reference numerals.

[0072] Fig. 1 shows an exemplary class diagram 1 of an embodiment of a computer program. The abstract class 2 "Interface" can have an attribute 3 called "Attribute" and a method 4 called "Operation." All attributes and methods are abstract in this embodiment. Therefore, this abstract class 2 is an interface 2. In this embodiment, the attribute 3 is of the data type String 5. In particular, the attribute 3 can be a character string. The method 4 "Operation" expects a transfer parameter 6 "Value" of the data type String 7. A return value of the method 4 "Operation" is of a Boolean data type 8.

[0073] The inheriting class 9, "inheriting class," implements interface 2. This means that the inheriting class 9 also has an attribute 10, "attribute," and a method 11, "operation." The inheriting class 9 may also have additional attributes and methods. It may also inherit from another interface. In particular, the inheriting class 9 has all the attributes and methods of interface 2. The methods and attributes of the inheriting class are all non-abstract.

[0074] If an object is created which is derived from the inheriting class 9, then all abstract members of interface 2 are checked to see if there is a non-abstract member in the inheriting class 9 that has the same properties. For example, interface 2 has attribute 3 "Attribute". The inheriting class 9 also has attribute 10 called "Attribute". Therefore, the member's Name property matches. Both attributes are attributes and not methods. Therefore, these members also match in terms of type. In particular, the data type of attributes 5 and 12 is also compared. Both attributes are of the data type String 5 and 12. Therefore, this property also matches. When comparing method 4 "Operation" of interface 2 with method 11 "Operation" of the inheriting class 9, it can be seen that they match in terms of the Name property.Comparing their parameters, it can be seen that they have the same name "Value" 6, 13 and are of the same data type "String" 7, 14. The return value of the "Operation" member of interface 2 is a Boolean data type 8, and the return value of the "Operation" member of the inheriting class 9 is also a Boolean data type 15. Since for all abstract members 3, 4 of interface 2, a non-abstract member 10, 11 of the inheriting class 9 can be found that matches with regard to all compared properties, it can be assumed that the inheriting class 9 has correctly inherited from interface 2.To ensure that the members of the correct inheriting class are compared with the members of the correct interface, a relationship between interface 2 and the inheriting class 9 can be checked by checking for the object to be created whether it is derived from both the inheriting class 9 and the interface 2.

[0075] This procedure is particularly advantageous when performed before executing a main part, especially during a unit test. This can shorten the time until a Type I error is detected. A Type I error occurs, in particular, when not all abstract members are implemented in the inheriting class 9, or when the member in the inheriting class 9 does not match the abstract member in terms of its properties.

[0076] A software component "client" accesses interface 2 when it accesses an object that is an instance of a class inheriting from interface 2. To ensure that the object is an instance of a class 9 inheriting from interface 2, this is checked in one embodiment. For this purpose, a function decorator @typechecked can be used, for example.

[0077] To shorten the time until a type II error is detected, in one embodiment, this check is also performed before executing the main part. In particular, the check is performed in a unit test and / or in a composition root at the beginning of the computer program's execution when constructors are called. In this embodiment, it is referred to as a type II error if a software component, in particular according to a program code, accesses an object via an interface that does not belong to the object, in particular does not reference the object.

[0078] If a type I error and / or a type II error is detected in one embodiment, an error message is output. If necessary, execution of the main part is prevented. The error message can be output to a user and / or made available to an external system. In particular, the external system can automatically correct the type I error and / or the type II error. If a type I error is detected during instantiation, an exception is generated. An example of an incorrect implementation is: from happy. typing import Abstractclass, abstractmethod, typechecked

[0079] # Definition of the interface class ITest(AbstractClass):

[0080] @abstractmethod

[0081] @typechecked def foo(self, value:int) -> str:

[0082] ©property

[0083] @abstractmethod def bar(self) -> float:

[0084] # incorrect implementation

[0085] # - foo does not have the @typechecked decorator

[0086] # - bar is not a property that CTestlncorrect(ITest): def foo(self, value:int) -> str: def bar(self) -> float:

[0087] For example, the incorrect realization is instantiated as follows: ci = CTestlncorrect()

[0088] Triggered by the instantiation, the following error message is displayed for this example faulty implementation:

[0089] "Conflicting signature for function 'foo' (function(self, value: int) -> str) in class CTestlncorrect while abstract symbols in class ITest is @typechecked function(self, value: int) -> str. Conflicting signature for function 'bar' (function(self) -> float) in class CTestlncorrect while abstract symbols in class ITest is property[get](self) -> float.

[0090] TypeError: Can't instantiate abstract class CTestlncorrect with abstract methods bar, foo ci = CTestlncorrectO"

[0091] Furthermore, testing, especially when using the Python programming language, can be performed as follows: A computer program component, in particular the "happy. typing" library, extends the "Abstract Base Class" (ABC implementation) with an implementation that only accepts a realization of interfaces if:

[0092] - every abstract member has been implemented by the class,

[0093] - the type of the abstract member is the same as in the interface,

[0094] - the arguments of the abstract member are the same as in the interface,

[0095] - the types of the arguments and the return type of the abstract member are the same as in the interface, and

[0096] - the decorators of the abstract member are the same as in the interface. The complete signature of the member is checked, not just the name, as in the original ABC implementation. However, the check still takes place at runtime, when the class is first instantiated. To ensure that the implementation of a class matches an interface, the class must be instantiated. Therefore, it is sufficient to create a simple unit test that simply creates an instance of the class. If the unit test passes, the implementation of the class is consistent with the interface. The strict consistency check thus takes place at unit test time, which is much earlier than the application's runtime and very similar to the "compile time" of normal, especially compiled, programming languages.Every function / method assigned a reference to the interface should use a type hint for that interface and should use the "@typechecked" decorator to perform a runtime check on the reference. If the reference is not an instance of the interface, the runtime check would fail. This way, only classes that implement the interface can be assigned to the argument of that function / method. However, this check only takes place at runtime, which is too late for a "compile-time-like" check. Dependency injection is a pattern in which software components never directly depend on other software components, but rather on abstractions, especially interfaces. Furthermore, instances of all dependencies are created in a single location in the application. This location is called the "composition root."Within the composition root, dependencies are passed to the constructors of other classes to build a dependency tree. If an instance does not match the expected type of the interface, the type check at runtime of the constructor will fail. This error occurs in the composition root, which is executed directly at application startup. The error is visible immediately at startup. Alternatively, the composition root can also be tested in a simple unit test by executing the code without further checks. This testing technique provides interfaces in Python that can be used, as in other programming languages, to increase the reusability, maintainability, and stability of applications.

[0097] For example, the computer program, particularly the one being tested, can be used for web applications that contain artificial intelligence algorithms (AI algorithms) and / or are used by specialist departments. In particular, the computer program being tested can be used in a vehicle, for example, for web applications in the vehicle.

[0098] Furthermore, the following can apply when implementing the procedure: The type of implementation of a realization of an interface corresponds to a common pattern from other programming languages ​​(derivation from the interface) and does not require any special keywords that could potentially be forgotten. In particular, a complete check of the properties of all abstract attributes takes place so that no accidental incorrect realization of an attribute can occur. For example, the check of the realization for completeness only takes place at instantiation, which means that the class can still be extended at runtime after definition, or it can still be derived from it and completeness is then established in the derivation. In particular, function decorators are taken into account as properties, especially if they have been specially prepared, which is extremely important for runtime type checking, especially with the @typechecked decorator.It should be noted that the conventional concept of interfaces and their implementation in other OOP languages, especially compilable programming languages, always distinguishes between compile time and execution time (runtime). In these programming languages, the completeness of an implementation is checked statically during compile time. In Python, there is no compile time, only execution time, which is why the check takes place at the time of instantiation. However, this problem can be circumvented by consistently using the @typechecked indicator together with the interfaces mentioned here, provided that the classes are consistently tested by unit tests and integration tests. In this case, the same code quality can be achieved despite the disadvantage of testing at execution time instead of compile time, since any deviation of an implementation from the interface is detected very quickly.For this purpose, only a single test case is sufficient for each implementation. This can be programmed, for example, as follows: def test_realization(): instance = Realization() assert isinstance(instance, Interface).

[0099] The first check occurs implicitly when the "Realization" class is instantiated. Using the described concept, the implementation is checked for completeness. The second check occurs afterward and checks whether the instantiated class is actually derived from the expected interface. If every implemented class receives such a test, it is ensured that each implementation fully implements the respective interface. The check no longer actually takes place at runtime (which means errors are only discovered later), but rather at the time of the unit test. Thus, Python achieves the same level of security in interface programming that is otherwise only known from compilable OOP programming languages.

[0100] List of reference symbols

[0101] Class diagram abstract class, interface

[0102] Class member

[0103] Class member

[0104] Data type

[0105] Transfer parameters

[0106] Data type

[0107] Data type inheriting class

[0108] Class member

[0109] Class member

[0110] Data type

[0111] Transfer parameters

[0112] Data type

[0113] Data type

Claims

Patent claims Method for testing a computer program programmed in an object-oriented scripting language, comprising the following steps: Providing a computer program part for generating abstract classes (2); Providing at least one abstract class (2) which has at least one abstract member (3, 4), in particular only abstract members, by means of the computer program part; Providing a class (9) inheriting from the abstract class (2) which has only non-abstract members (10, 11); Creating an object derived from the inheriting class (9), whereby this object represents a reference to the abstract class (9), - wherein properties of the non-abstract members (10, 11) of the inheriting class (9) are compared with the properties of the abstract members (3, 4) of the abstract class (2); and if there is at least one abstract member (3, 4) of the abstract class (2) for which no non-abstract member (10, 11) of the inheriting class (9) with the same properties is found, an entry is created in an error list, which is then output as an error message. The method according to claim 1, comprising the following further steps: Checking all objects referenced by a software component of the computer program to determine whether the respective referenced object represents a reference to the associated abstract class (2); and if at least one checked object referential to a software component does not represent the reference to the associated class (2), a further error message is output. Method according to claim 1 or 2, wherein the following properties are compared: Names of members (3, 4, 10, 11), Type and data type (5, 12) of the respective member (3, 4, 10 ,11), and - Arguments (6, 13) of the respective member (4, 11), and Data type (7, 14) of the respective argument (6, 13) of the member (4, 11), and data type (8, 15) of a return value, Method according to one of the preceding claims, wherein an object is created for each inheriting class (9) of the computer program before executing a main part of the computer program, and a check is carried out to determine whether the respective creation was successful. Method according to one of the preceding claims, wherein all software components of the computer program, in particular only, depend on abstract classes (2), wherein dependencies of the software components, in particular those that inherit from the abstract classes (2), are created and transferred centrally. Method according to one of the preceding claims, wherein the computer program is programmed and tested in a Python programming language.Method for executing a computer program, in which testing of the computer program is carried out before execution of a main part of the computer program according to one of the preceding claims 1 to 6, and if an entry is made in the error list or an error message is output, the execution of the main part is prevented, and if no entry is made in the error list or an error message is output, the main part of the computer program is started, in particular automatically, and / or the method according to one of the preceding claims 1 to 6 is carried out at least once during an already started execution of the main part, in particular is carried out when an object derived from an inheriting class (9) is created. System for carrying out a method, comprising means for carrying out the steps of the method according to one of the preceding claims.A computer program which is tested according to a method according to any one of claims 1 to 6 and is loadable into a memory unit and executable by a processor. A computer-readable storage medium comprising instructions which, when executed by a computer, cause the computer to carry out the steps of the method according to any one of claims 1 to 7.