├── .devcontainer
└── devcontainer.json
├── .gitignore
├── LICENSE
├── README.md
├── analysis.py
├── app.py
├── requirements.txt
├── snapshot.csv
└── tests
├── README.md
├── test_basic_validation.py
├── test_fallback_mechanism.py
└── test_normal_operation.py
/.devcontainer/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Python 3",
3 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
4 | "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
5 | "customizations": {
6 | "codespaces": {
7 | "openFiles": [
8 | "README.md",
9 | "app.py"
10 | ]
11 | },
12 | "vscode": {
13 | "settings": {},
14 | "extensions": [
15 | "ms-python.python",
16 | "ms-python.vscode-pylance"
17 | ]
18 | }
19 | },
20 | "updateContentCommand": "[ -f packages.txt ] && sudo apt update && sudo apt upgrade -y && sudo xargs apt install -y
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # List of open source UML tools
2 |
3 | Based on a search in GitHub. Dashboard created as part of the [BESSER project](https://github.com/besser-pearl)
4 |
5 | See the [dashboard live](https://oss-uml-tools.streamlit.app/).
6 |
7 | ## Selection method
8 | The selection method is based on the following inclusion criteria:
9 | - Repositories that declare themselves as UML projects
10 | - Repositories with 50+ stars
11 | - Active repositories (last commit not more than 1 year ago)
12 | - Repos aimed at rendering, editing or generating from any type of UML model
13 | and exclusion criteria
14 | - Repositories with no information in English
15 | - Repositories that were just created to host the source code of a published article
16 | - Repositories that are awesome lists or collection of resources or examples
17 |
18 | The final list is the intersection of the above criteria manually curated to remove projects that use UML in a different sense of what we mean by UML in software development.
19 |
20 | For more information about UML tools:
21 |
22 | - This list of [UML tools](https://modeling-languages.com/uml-tools/) and [UML books](https://modeling-languages.com/list-uml-books/)
23 | - Our open source low-code-tool [BESSER](https://github.com/BESSER-PEARL/BESSER) that includes a web-based UML editor
24 | - Read about the role of [UML in modern development approaches](https://lowcode-book.com/)
25 |
--------------------------------------------------------------------------------
/analysis.py:
--------------------------------------------------------------------------------
1 | import streamlit as st
2 | import plotly.graph_objects as go
3 |
4 | def analyze_repos_multiple_keywords(repos, keywords, category_name):
5 | """Analyze repositories for multiple keywords within a category"""
6 | matching_repos = []
7 | non_matching_repos = []
8 |
9 | for repo in repos:
10 | description = (repo.get('description', '') or '').lower()
11 | name = (repo.get('name', '') or '').lower()
12 | topics = [t.lower() for t in repo.get('topics', [])]
13 |
14 | # Check if any of the keywords match
15 | matches = any(
16 | (keyword in description if keyword != 'ai' else (' ai ' in description or ' ai-' in description)) or
17 | (keyword in name if keyword != 'ai' else (' ai ' in name or ' ai-' in name)) or
18 | any(keyword == topic.strip() for topic in topics)
19 | for keyword in keywords
20 | )
21 |
22 | if matches:
23 | matching_repos.append(repo)
24 | else:
25 | non_matching_repos.append(repo)
26 |
27 | return matching_repos, non_matching_repos
28 |
29 | def display_analysis(repos, category):
30 | """Display pie chart and table for a specific category analysis"""
31 | # Define keyword sets for each category
32 | keyword_sets = {
33 | 'nocode': ['nocode', 'no-code', 'no code'],
34 | 'lowcode': ['lowcode', 'low code', 'low-code'],
35 | 'ai': ['ai', 'artificial intelligence'],
36 | 'plantuml': ['plantuml', 'plant uml', 'plant-uml'],
37 | 'ocl': ['ocl', 'object-constraint-language', 'object constraint language']
38 | }
39 |
40 |
41 | # Filter out specific repos for modeling category
42 | repos_to_analyze = repos
43 |
44 | matching_repos, non_matching_repos = analyze_repos_multiple_keywords(
45 | repos_to_analyze,
46 | keyword_sets[category],
47 | category
48 | )
49 |
50 | fig = go.Figure(data=[go.Pie(
51 | labels=[f'Mentions {category}', f'No {category} mention'],
52 | values=[len(matching_repos), len(non_matching_repos)],
53 | hole=0.3,
54 | marker_colors=['#2ecc71', '#e74c3c']
55 | )])
56 |
57 | fig.update_layout(
58 | title=f'Distribution of UML tools mentioning also {category}',
59 | showlegend=True,
60 | width=700,
61 | height=500,
62 | annotations=[{
63 | 'text': f'Total: {len(repos)}',
64 | 'x': 0.5,
65 | 'y': 0.5,
66 | 'font_size': 20,
67 | 'showarrow': False
68 | }]
69 | )
70 |
71 | st.plotly_chart(fig)
72 |
73 | if matching_repos:
74 | st.write(f"### UML Tools Mentioning '{category}'")
75 | data = [{
76 | 'Name': repo['name'],
77 | 'Description': repo.get('description', 'No description'),
78 | 'Stars': repo.get('stargazers_count', 0)
79 | } for repo in matching_repos]
80 | st.table(data)
81 | else:
82 | st.write(f"No repositories found mentioning '{category}'")
--------------------------------------------------------------------------------
/app.py:
--------------------------------------------------------------------------------
1 | from datetime import datetime, timedelta
2 | from collections import Counter
3 | import streamlit as st
4 | import requests
5 | import plotly.graph_objects as go
6 | from analysis import display_analysis
7 | import pandas as pd
8 | import os
9 |
10 | # Set page configuration FIRST - must be the very first Streamlit command
11 | st.set_page_config(layout="wide")
12 |
13 | # GitHub API endpoint for searching repositories
14 | GITHUB_API_URL = "https://api.github.com/search/repositories"
15 |
16 | # Function to fetch repositories. Only repos with stars > 50 and updated in the last year are shown
17 | def fetch_uml_repos(query="uml", sort="stars", order="desc", per_page=100, max_pages=10):
18 | query += " stars:>=" + "50" + " pushed:>=" + (datetime.now() - timedelta(days=365)).strftime("%Y-%m-%d")
19 | all_repos = []
20 | api_failed = False
21 |
22 | for page in range(1, max_pages + 1):
23 | params = {
24 | "q": query,
25 | "sort": sort,
26 | "order": order,
27 | "per_page": per_page,
28 | "page": page
29 | }
30 | try:
31 | response = requests.get(GITHUB_API_URL, params=params, timeout=10)
32 | if response.status_code == 200:
33 | repos = response.json()["items"]
34 | if not repos:
35 | break
36 | all_repos.extend(repos)
37 | else:
38 | st.error(f"Error fetching data from GitHub API: {response.status_code}")
39 | api_failed = True
40 | break
41 | except requests.exceptions.RequestException as e:
42 | st.error(f"GitHub API request failed: {str(e)}")
43 | api_failed = True
44 | break
45 |
46 | # If API failed or returned no data, load from snapshot.csv
47 | if api_failed or not all_repos:
48 | try:
49 | snapshot_path = "snapshot.csv"
50 | if os.path.exists(snapshot_path):
51 | st.warning("⚠️ GitHub API is unavailable. Loading data from snapshot.csv instead.")
52 | df = pd.read_csv(snapshot_path, encoding='utf-8-sig') # Handle BOM
53 |
54 | # Convert CSV data back to GitHub API format
55 | all_repos = []
56 | for _, row in df.iterrows():
57 | repo_data = {
58 | "name": row["Name"],
59 | "stargazers_count": row["Stars⭐"],
60 | "pushed_at": row["Last Updated"] + "T00:00:00Z",
61 | "created_at": row["First Commit"] + "T00:00:00Z",
62 | "html_url": row["URL"],
63 | "forks": row["Forks"],
64 | "open_issues": row["Issues"],
65 | "language": row["Language"] if row["Language"] and row["Language"] != "No language" else None,
66 | "license": {"name": row["License"]} if row["License"] != "No license" else None,
67 | "description": row["Description"] if row["Description"] != "No description" else None,
68 | "topics": row["Topics"].split(",") if pd.notna(row["Topics"]) and row["Topics"] else []
69 | }
70 | all_repos.append(repo_data)
71 |
72 | st.info(f"✅ Loaded {len(all_repos)} repositories from snapshot data.")
73 | else:
74 | st.error("GitHub API failed and no snapshot.csv file found.")
75 | except Exception as e:
76 | st.error(f"Failed to load snapshot data: {str(e)}")
77 |
78 | return all_repos
79 |
80 |
81 | # Fetch repositories
82 | if 'repos' not in st.session_state:
83 | st.session_state.repos = fetch_uml_repos()
84 |
85 | # List of excluded repositories
86 | excluded_repos = {
87 | "awesome-low-level-design", "Books-Free-Books", "awesome-diagramming", "plantuml-examples", "plantuml-examples", "hogwarts-artifacts-online", "-Enterprise-Architect-16-Crack-renewal-", "UoM-Applied-Informatics", "UML-Best-Practices",
88 | "design-pattern-examples-in-python", "design-pattern-examples-in-crystal", "FreeTakServer", "plantuml-icon-font-sprites", "snow-owl", "StarUML-CrackedAndTranslate", "tiro-notes", "QuickUMLS"
89 | }
90 |
91 | # Filter out excluded repositories
92 | st.session_state.repos = [repo for repo in st.session_state.repos if repo['name'] not in excluded_repos]
93 |
94 | repos = st.session_state.repos
95 |
96 |
97 | # Display the table
98 | st.title("Dashboard of Open-Source UML Tools in GitHub")
99 | st.subheader("Maintained by the [BESSER team](https://github.com/BESSER-PEARL/BESSER)")
100 |
101 | # Add table of contents
102 | st.markdown("""
103 | ## Table of Contents
104 | - [Quick Notes](#quick-notes)
105 | - [Repository Filters](#repository-filters)
106 | - [Repository Table](#repository-table)
107 | - [Selection Method](#selection-method)
108 | - [Global Statistics](#global-statistics)
109 | - [Tools covering as well other concepts](#repository-analysis)
110 | - [UML and no-code](#analysis-for-nocode)
111 | - [UML and low-code](#analysis-for-lowcode)
112 | - [UML and AI](#analysis-for-ai)
113 | - [UML tools in the PlantUML ecosystem](#analysis-for-plantuml)
114 | - [UML and OCL](#analysis-for-ocl)
115 |
116 | """)
117 |
118 | st.markdown("", unsafe_allow_html=True)
119 | st.write("## Quick notes:")
120 | st.write("- Use the sliders to filter the repositories. Click on a column header to sort the table.")
121 | st.write("- Hover over the table to search for specific reports or export the table as a CSV file.")
122 | st.write("- A few global stats are also available at the bottom of the page.")
123 | st.write("- Suggest improvements via the [GitHub repository of this dashboard](https://github.com/jcabot/oss-uml-tools)")
124 |
125 | # Add anchors before each section
126 | st.markdown("", unsafe_allow_html=True)
127 | st.write("## Repository Filters")
128 |
129 | # Add star filter slider
130 | min_stars = st.slider("Minimum Stars", min_value=50, max_value=50000, value=50, step=50)
131 |
132 | # Add a date filter slider
133 | # Calculate date range, also storing the value in the session to avoid the slider resetting all the time due to
134 | # streamlit thinking the min max value have changed and need to restart
135 |
136 | if 'today' not in st.session_state:
137 | st.session_state.today = datetime.today()
138 |
139 | today = st.session_state.today
140 | one_year_ago = today - timedelta(days=365)
141 |
142 | # Date slider
143 | min_date = st.slider(
144 | "Last Commit",
145 | min_value=one_year_ago,
146 | max_value=today,
147 | value=one_year_ago,
148 | step=timedelta(days=1)
149 | )
150 |
151 |
152 |
153 | if repos:
154 | # Create a table with repository information. Only repos with stars >= min_stars and last commit >= min_date are shown
155 | table_data = []
156 |
157 | filtered_repos = [repo for repo in repos if repo['stargazers_count'] >= min_stars and datetime.strptime(repo['pushed_at'].split('T')[0], '%Y-%m-%d').date() >= min_date.date()]
158 |
159 | for repo in filtered_repos:
160 | table_data.append({
161 | "Name": repo["name"],
162 | "Stars⭐": repo['stargazers_count'],
163 | "Last Updated": repo['pushed_at'].split('T')[0],
164 | "First Commit": repo['created_at'].split('T')[0],
165 | "URL": repo['html_url'],
166 | "Forks": repo['forks'],
167 | "Issues": repo['open_issues'],
168 | "Language": repo['language'],
169 | "License": repo['license']['name'] if repo['license'] else "No license",
170 | "Description": (repo["description"] or "No description")[:200],
171 | "Topics": repo['topics']
172 | })
173 |
174 | st.write(f"Showing {len(table_data)} repositories")
175 | st.dataframe(
176 | table_data,
177 | column_config={
178 | "URL": st.column_config.LinkColumn("URL")
179 | },
180 | use_container_width=True,
181 | height=(len(table_data)+1)*35+3,
182 | hide_index=True
183 | )
184 |
185 | st.markdown("", unsafe_allow_html=True)
186 | st.subheader("Selection method")
187 |
188 | #Write the selection method
189 |
190 |
191 | st.write("The selection method is based on the following inclusion criteria:")
192 | st.write("- Repositories that declare themselves as UML projects")
193 | st.write("- Repositories with more than 50 stars")
194 | st.write("- Active repositories (last commit is no more than 1 year ago")
195 | st.write("- Tool aims to render, edit or generate from UML models")
196 | st.write("and exclusion criteria:")
197 | st.write("- Repositories with no information in English")
198 | st.write("- Repositories that were just created to host the source code of a published article")
199 | st.write("- Repositories that are awesome lists or collection of resources or examples")
200 |
201 | st.write("The final list is the intersection of the above criteria. The final list has also been manually curated to remove projects that use UML in a different sense of what we mean by UML in software engineering.")
202 | st.write("For more information about UML tools:")
203 | st.write("- See this list of [UML tools](https://modeling-languages.com/uml-tools/)")
204 | st.write("- Check out these [UML books](https://modeling-languages.com/list-uml-books/)")
205 | st.write("- Play with UML via our open source low-code tool [BESSER](https://github.com/BESSER-PEARL/BESSER) that comes with a web-based UML editor")
206 | st.write("- And learn about the role of [UML in modern development approaches](https://lowcode-book.com/)")
207 |
208 | st.markdown("", unsafe_allow_html=True)
209 | st.subheader("Some global stats")
210 |
211 | # Create a list of first commit dates
212 | first_commit_dates = [datetime.strptime(repo['created_at'].split('T')[0], '%Y-%m-%d').date() for repo in
213 | filtered_repos]
214 |
215 | # Grouping the data by year
216 | years = [date.year for date in first_commit_dates]
217 | year_counts = Counter(years)
218 |
219 | # Plotting the distribution of first commit dates by year
220 | year_bar_chart = go.Figure(
221 | data=[
222 | go.Bar(
223 | x=list(year_counts.keys()),
224 | y=list(year_counts.values()),
225 | )
226 | ]
227 | )
228 | year_bar_chart.update_layout(
229 | title="Distribution of First Commit Dates by Year",
230 | xaxis_title="Year of First Commit",
231 | yaxis_title="Number of Repositories",
232 | xaxis=dict(tickangle=45)
233 | )
234 |
235 | # Create a list of star counts
236 | star_counts = [repo['stargazers_count'] for repo in filtered_repos]
237 |
238 | # Plotting the distribution of repositories by star count using a boxplot
239 | star_box_plot = go.Figure(
240 | data=[
241 | go.Box(
242 | x=star_counts,
243 | boxpoints="outliers", # Show only outliers as points
244 | jitter=0.5,
245 | )
246 | ]
247 | )
248 | star_box_plot.update_layout(
249 | title="Distribution of Repositories by Star Count",
250 | xaxis_title="",
251 | yaxis_title="Number of Stars",
252 | xaxis=dict(showticklabels=False)
253 | )
254 |
255 | # Create a list of languages from filtered_repos
256 | languages = [repo['language'] for repo in filtered_repos if repo['language']]
257 |
258 | # Count the occurrences of each language
259 | language_counts = Counter(languages)
260 |
261 | # Plotting the aggregation of repositories by language
262 | language_bar_chart = go.Figure(
263 | data=[
264 | go.Bar(
265 | x=list(language_counts.keys()),
266 | y=list(language_counts.values()),
267 | )
268 | ]
269 | )
270 | language_bar_chart.update_layout(
271 | title="Aggregation of Repositories by Language",
272 | xaxis_title="Programming Language",
273 | yaxis_title="Number of Repositories",
274 | xaxis=dict(tickangle=45)
275 | )
276 |
277 | cols = st.columns(2)
278 | with cols[0]:
279 | st.plotly_chart(year_bar_chart, use_container_width=True)
280 | st.plotly_chart(language_bar_chart, use_container_width=True)
281 | with cols[1]:
282 | st.plotly_chart(star_box_plot, use_container_width=True)
283 |
284 | else:
285 | st.write("No repositories found or there was an error fetching data.")
286 |
287 |
288 | if 'repos' in st.session_state and st.session_state.repos:
289 | st.write("## Repository Analysis")
290 |
291 | for keyword in ['nocode','lowcode', 'ai', 'plantuml', 'ocl']:
292 | st.write(f"### Analysis for '{keyword}'")
293 | display_analysis(st.session_state.repos, keyword)
294 | st.markdown("---")
295 | else:
296 | st.warning("Please fetch repositories first using the search functionality above.")
297 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | streamlit~=1.40.1
2 | requests~=2.32.3
3 | plotly~=6.1.2
4 | pandas~=2.3.0
--------------------------------------------------------------------------------
/snapshot.csv:
--------------------------------------------------------------------------------
1 | Name,Stars⭐,Last Updated,First Commit,URL,Forks,Issues,Language,License,Description,Topics
2 | tui.editor,17544,2024-08-01,2015-07-27,https://github.com/nhn/tui.editor,1805,628,TypeScript,MIT License,🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.,"chart,commonmark,documentation,editor,frontend,gfm,html,jquery,jquery-plugin,markdown,uml,wysiwyg"
3 | vnote,12423,2025-05-16,2016-10-05,https://github.com/vnotex/vnote,1254,657,C++,GNU Lesser General Public License v3.0,A pleasant note-taking platform in native C++.,"editor,markdown,mathjax,note,note-taking,uml,vim,vnote"
4 | plantuml,11624,2025-06-05,2010-11-04,https://github.com/plantuml/plantuml,1042,516,Java,Other,Generate diagrams from textual description,"diagram,diagram-as-code,diagrams,diagrams-as-code,java,plantuml,uml,uml-diagram"
5 | LogicFlow,9882,2025-06-05,2020-12-24,https://github.com/didi/LogicFlow,1215,127,TypeScript,Apache License 2.0,A flow chart editing framework focus on business customization. 专注于业务自定义的流程图编辑框架,支持实现脑图、ER图、UML、工作流等各种图编辑场景。,"bpmn,diagram,diagramming,didi,flow,flowchart,graph,javascript,javascript-diagramming-library,mvvm,svg,typescript,visualization"
6 | C4-PlantUML,6764,2025-05-12,2018-09-05,https://github.com/plantuml-stdlib/C4-PlantUML,1129,1,PlantUML,MIT License,C4-PlantUML combines the benefits of PlantUML and the C4 model for providing a simple way of describing and communicate software architectures,"architecture,c4,c4model,diagram,graphviz,plantuml,uml"
7 | kroki,3271,2025-06-05,2019-01-10,https://github.com/yuzutech/kroki,246,129,JavaScript,MIT License,Creates diagrams from textual descriptions!,"api,blockdiag,bpmn,bytefield,c4,diagrams,ditaa,erd,excalidraw,graphviz,hacktoberfest,images,mermaid,pikchr,plantuml,svgbob,text,uml,umlet,wavedrom"
8 | nomnoml,2768,2025-03-31,2014-06-03,https://github.com/skanaar/nomnoml,209,14,TypeScript,MIT License,The sassy UML diagram renderer,"class-diagram,diagram,flowchart,nomnoml,uml"
9 | gaphor,2045,2025-06-05,2009-06-24,https://github.com/gaphor/gaphor,212,146,Python,No license,Gaphor is the simple modeling tool,"c4model,diagram,fta,gnome,gtk,mbse,model-based-systems-engineering,modeling,python,stpa,sysml,uml"
10 | Diagon,1973,2025-05-16,2018-01-22,https://github.com/ArthurSonzogni/Diagon,71,21,C++,MIT License,Interactive ASCII art diagram generators. :star2:,"antlr,arthursonzogni,ascii,ascii-art,ascii-diagram,cmake,cpp,generators,lexer,markdown,parser,uml,uml-diagram,unicode,webapp,webapplication,webassembly"
11 | umlet,1541,2024-10-29,2015-03-18,https://github.com/umlet/umlet,311,182,JavaScript,GNU General Public License v3.0,Free UML Tool for Fast UML Diagrams,
12 | arkit,960,2025-06-02,2019-01-29,https://github.com/dyatko/arkit,45,24,JavaScript,MIT License,JavaScript architecture diagrams and dependency graphs,"architecture,cli,codebase,component,diagram,flow,generate,javascript,js,plantuml,ts,typescript,uml,visualisation"
13 | Modelio,850,2024-06-28,2020-09-03,https://github.com/ModelioOpenSource/Modelio,138,66,Java,GNU General Public License v3.0,"Modelio is a modeling solution offering a wide range of functionalities based on the main standards of enterprise architecture, software development and systems engineering.","archimate,bpmn,bpmn-support,enterprise-architecture,java,model,modeling-tool,modelio,togaf,uml,xmi"
14 | state-machine-cat,829,2025-05-21,2016-09-14,https://github.com/sverweij/state-machine-cat,45,6,TypeScript,MIT License,write beautiful state charts :scream_cat:,"scxml,state-diagram,state-machine,statechart,uml"
15 | clang-uml,771,2025-05-29,2021-02-14,https://github.com/bkryza/clang-uml,51,16,C++,Apache License 2.0,Customizable automatic UML diagram generator for C++ based on Clang.,"clang,cplusplus,cpp,cpp17,libclang,mermaidjs,plantuml,uml"
16 | PlantUmlClassDiagramGenerator,730,2025-05-17,2015-09-03,https://github.com/pierre3/PlantUmlClassDiagramGenerator,137,42,C#,MIT License,This is a generator to create a class-diagram of PlantUML from the C# source code.,"c-sharp,class-diagram,plantuml"
17 | JetUML,649,2025-05-23,2015-01-07,https://github.com/prmr/JetUML,129,6,Java,GNU General Public License v3.0,A desktop application for fast UML diagramming.,"desktop-application,diagram,java,javafx,modeling,modeling-tool,uml,uml-diagrams"
18 | tx2uml,454,2025-01-24,2020-02-24,https://github.com/naddison36/tx2uml,36,2,TypeScript,MIT License,Ethereum transaction visualizer. Generates UML sequence diagram for a transaction's contract calls.,
19 | jdl-studio,406,2024-12-31,2016-02-20,https://github.com/jhipster/jdl-studio,116,13,TypeScript,Apache License 2.0,JDL Studio is an online JHipster Domain Language visual editor,"design,entity-model,hacktoberfest,jdl,jdl-studio,jhipster,jpa,uml"
20 | sphinxcontrib-mermaid,365,2025-04-29,2016-06-23,https://github.com/mgaitan/sphinxcontrib-mermaid,99,36,Python,Other,Mermaid diagrams in yours sphinx powered docs,"diagrams,sphinx-doc,sphinx-extension,sphinxcontrib,uml"
21 | TsUML2,304,2024-12-17,2020-04-30,https://github.com/demike/TsUML2,38,16,TypeScript,MIT License,Generates UML diagrams from TypeScript source code,"class,diagram,generator,typescript,uml"
22 | umple,266,2025-05-04,2015-08-26,https://github.com/umple/umple,201,365,Java,MIT License,"Umple: Model-Oriented Programming - embed models in code and vice versa and generate complete systems. Save yourself lots of coding. Do it collaboratively online in UmpleOnline, in an IDE or on the co","class-diagram,code-generation,editor,low-code,modeling,state-machine,uml,umple"
23 | umldoclet,246,2025-06-03,2016-02-18,https://github.com/talsma-ict/umldoclet,31,16,Java,Apache License 2.0,Automatically generate PlantUML diagrams in javadoc,"code-analysis,diagram,doclet,generator,javadoc,plantuml,uml"
24 | overarch,246,2025-06-05,2023-05-07,https://github.com/soulspace-org/overarch,6,1,Clojure,Eclipse Public License 1.0,"Overarch provides a data model for the holistic description of a software system, opening multiple use cases on the model data. Supports C4 and UML diagram generation with PlantUML.","architecture,c4model,clojure,diagrams,edn,generation,graphviz,json,markdown,modelling,plantuml,structurizr,systems"
25 | amateras-modeler,234,2024-07-07,2015-06-29,https://github.com/takezoe/amateras-modeler,65,10,Java,No license,UML and ER-diagram editor for Eclipse,"database,eclipse,eclipse-plugin,er-diagram,modeling,uml,uml-diagram"
26 | Archimate-PlantUML,232,2024-11-27,2019-01-15,https://github.com/plantuml-stdlib/Archimate-PlantUML,63,2,,MIT License,PlantUML macros and other includes for Archimate Diagrams,"archimate,architecture,architecture-as-code,diagram,graphviz,plantuml,uml,uml-diagrams"
27 | ecto_erd,231,2025-04-13,2021-08-22,https://github.com/fuelen/ecto_erd,16,5,Elixir,Apache License 2.0,A mix task for generating Entity Relationship Diagram from Ecto schemas available in your project.,"dbml,ecto,elixir,erd,graphviz,mermaid,plantuml,uml"
28 | pddon-win,231,2024-09-12,2023-08-08,https://github.com/pddon/pddon-win,20,1,HTML,MIT License,"PDDON windows client, PDDON is a daily drawing tool that supports low code for learning or office use. It can be used for flowchart, mind map, UML diagram, ER diagram, network topology diagram, BPMN, ","ai,architecture-diagram,bpmn,class-diagram,diagram,drawing-tool,er-diagram,flowchart,html5,lowcode,mindmap,online,svg,tree-diagram,typescript,uml,venn-diagram,web"
29 | nomnoml,220,2024-12-11,2018-10-12,https://github.com/rstudio/nomnoml,18,3,JavaScript,Other,Sassy 'UML' Diagrams for R,"diagrams,htmlwidgets,nomnoml,r,rstats,uml"
30 | plantuml,212,2024-11-28,2011-01-04,https://github.com/hallvard/plantuml,59,33,Java,No license,Embed UML diagrams in files and view them in Eclipse,
31 | UML-State-Machine-in-C,183,2024-08-03,2018-12-27,https://github.com/kiishor/UML-State-Machine-in-C,50,4,C++,MIT License,A minimalist UML State machine framework for finite state machine and hierarchical state machine in C,"active-object,c,event-dispatcher,event-driven-programming,finite-state-machine,fsm,hierarchical-state-machine,hsm,state-machine,state-transition,state-transitions,uml-state-machine"
32 | NClass,180,2025-03-17,2015-09-04,https://github.com/gbaychev/NClass,51,24,C#,GNU General Public License v3.0,"NClass - the free UML editor, reloaded","class-diagram,class-diagram-generator,csharp,dotnet,uml,use-case-diagram,windows-forms"
33 | UmlautAdaptarr,175,2025-04-29,2024-02-06,https://github.com/PCJones/UmlautAdaptarr,6,26,C#,No license,"A tool to work around Sonarr, Radarr, Lidarr and Readarrs problems with foreign languages",
34 | vscode-mermaid-preview,172,2025-05-26,2016-05-12,https://github.com/Mermaid-Chart/vscode-mermaid-preview,21,19,TypeScript,MIT License,Previews Mermaid diagrams,"diagram,hacktoberfest,mermaid,previews-mermaid-diagrams,uml,vscode"
35 | uml-diagram-for-ddd-example-in-evans-book,167,2025-05-30,2025-04-17,https://github.com/takaakit/uml-diagram-for-ddd-example-in-evans-book,8,0,HTML,No license,UML diagram for the DDD example—a cargo shipping system—from Eric Evans' book,"domain-driven-design,java,uml"
36 | asciidoctor-kroki,162,2024-10-09,2019-04-22,https://github.com/asciidoctor/asciidoctor-kroki,53,39,JavaScript,MIT License,Asciidoctor.js extension to convert diagrams to images using Kroki!,"asciidoctor,asciidoctor-extension,asciidoctor-kroki,diagram,ditaa,extension,graphviz,hacktoberfest,javascript,kroki,mermaid,plantuml,uml"
37 | qm,155,2025-04-18,2016-12-13,https://github.com/QuantumLeaps/qm,40,6,Shell,Other,Graphical modeling and code generation tool based on UML state machines,"code-generation,code-generator,embedded-systems,free,fsm,graphical-models,hierarchical-state-machine,linux,macos,modeling-tool,object-oriented,qm-modeling,qp,samek,state-diagram,state-machine,statechart,uml,uml-state-machine,windows"
38 | sismic,148,2025-04-21,2015-11-30,https://github.com/AlexandreDecan/sismic,28,7,Python,GNU Lesser General Public License v3.0,Sismic Interactive Statechart Model Interpreter and Checker http://sismic.readthedocs.io/,"behavior-driven-development,design-by-contract,finite-state-machine,hierarchical-state-machine,property-testing,python,statecharts,testing,uml"
39 | pocketbase-uml.github.io,137,2025-02-04,2023-03-11,https://github.com/pocketbase-uml/pocketbase-uml.github.io,6,1,Svelte,MIT License,"A free, open-source web application that generates UML diagrams based on PocketBase databases","developer-tools,diagrams,pocketbase,tools,uml"
40 | web-sequence,129,2025-05-31,2017-09-30,https://github.com/ZenUml/web-sequence,27,67,JavaScript,MIT License,Realtime tool for generating sequence diagrams.,"chrome-extension,sequence-diagram,uml,uml-diagrams"
41 | umbrello,125,2025-06-05,2015-09-18,https://github.com/KDE/umbrello,39,0,C++,GNU General Public License v2.0,GUI for diagramming Unified Modelling Language (UML),
42 | prisma-uml,121,2025-05-29,2020-04-21,https://github.com/emyann/prisma-uml,10,39,TypeScript,No license,A CLI to transform a Prisma schema to a PlantUML Entity RelationShip Diagram,
43 | pumla,119,2025-03-30,2021-03-05,https://github.com/DrMarkusVoss/pumla,11,10,Python,GNU General Public License v3.0,pumla - systematic re-use of model elements described with PlantUML ,"architecture,architecture-models,c4-model,c4model,diagram,diagrams,json,markdown,plantuml,plantuml-manager,re-usable,requirements,requirements-management,requirements-tracing,software-architecture,uml"
44 | generate-plantuml-action,111,2024-06-18,2019-12-08,https://github.com/grassedge/generate-plantuml-action,166,20,TypeScript,MIT License,Generate uml diagrams with Plantuml Server and push them to your repository.,"github-actions,plantuml,uml-diagrams"
45 | ThingML,105,2024-10-03,2011-06-29,https://github.com/TelluIoT/ThingML,32,50,Java,Apache License 2.0,The ThingML modelling language,"arduino,c,eclipse-modeling,golang,internet-of-things,java,javascript,model-driven-development,modeling-language,state-machine,statechart,thingml,uml,xtext"
46 | openapi-to-plantuml,104,2025-06-02,2021-02-17,https://github.com/davidmoten/openapi-to-plantuml,21,7,Java,Apache License 2.0,Converts OpenAPI 3.0 definitions to Plant UML text for visualisation of your API.,"java,online,openapi,openapi-documentation,openapi3,plantuml,uml-diagram"
47 | doteur,104,2025-05-10,2021-04-24,https://github.com/nag763/doteur,7,1,Rust,MIT License,Tool to automate the visualisation of SQL schemas from a SQL file,"db,dot,graphviz,mysql,mysql-database,rust,sql,sqlite3,sqlite3-database,uml,vizualisation"
48 | plantuml-generator,103,2024-11-08,2018-11-04,https://github.com/devlauer/plantuml-generator,30,17,Java,Apache License 2.0,utility and maven plugin project for generating plantuml class diagrams and sequence diagrams out of java classes,"maven,plantuml,plantuml-generator,uml"
49 | uml-diagram-for-python-design-pattern-examples,99,2025-03-29,2020-12-24,https://github.com/takaakit/uml-diagram-for-python-design-pattern-examples,17,0,HTML,No license,UML diagram list of GoF design pattern examples written in Python.,"design-patterns,diagram,gof,python,uml"
50 | plantuml-service,99,2025-06-02,2016-08-06,https://github.com/bitjourney/plantuml-service,7,3,Kotlin,Other,"High-performance HTTP service for PlantUML, used in Kibela","kibela,plantuml,uml,web-api"
51 | PSClassUtils,96,2024-06-19,2018-06-15,https://github.com/Stephanevg/PSClassUtils,24,53,PowerShell,No license,A set of utilities to work with Powershell Classes,"classes,graphviz,powershell,powershell-modules,uml"
52 | DomainStory-PlantUML,94,2025-03-12,2020-02-29,https://github.com/johthor/DomainStory-PlantUML,6,7,Shell,MIT License,A PlantUML macro library to describe your domain story as code.,"domain-story,domain-storytelling,plantuml"
53 | BESSER,93,2025-06-05,2022-09-21,https://github.com/BESSER-PEARL/BESSER,18,43,Python,MIT License,A Python-based low-modeling low-code platform for smart and AI-enhanced software,"ai,code-generation,dsl,language-modeling,low-code,low-code-platform,lowcode,mde,metamodel,modeling,python,uml"
54 | PlantUmlViewer,92,2025-03-20,2022-05-20,https://github.com/Fruchtzwerg94/PlantUmlViewer,9,4,C#,MIT License,"A Notepad++ plugin to generate, view and export PlantUML diagrams","diagram,notepad-plus-plus,notepadplusplus,notepadpp,plant-uml,plantuml,plantuml-diagrams,uml"
55 | umls2rdf,86,2024-08-28,2012-02-06,https://github.com/ncbo/umls2rdf,36,13,Python,Other,These python scripts connect to the Unified Medical Language System (UMLS) database and translate the ontologies into RDF/OWL files. This is part of the BioPortal project.,
56 | Apollon,86,2025-04-01,2018-02-05,https://github.com/ls1intum/Apollon,30,74,TypeScript,MIT License,UML Modeling Editor written in React,"artemis,modeling-exercises,uml"
57 | protobuf-uml-diagram,76,2025-06-04,2019-05-16,https://github.com/kinow/protobuf-uml-diagram,14,1,Jupyter Notebook,Apache License 2.0,Create UML diagrams from Protobuf compiled .proto files using Python,"diagram,graphviz,hacktoberfest,protobuf,uml"
58 | textuml,76,2025-05-27,2014-06-14,https://github.com/abstratt/textuml,9,46,Java,Eclipse Public License 1.0,TextUML compiler and the TextUML Toolkit,"dsl,eclipse,textual,uml"
59 | epsilon,76,2025-05-28,2022-09-26,https://github.com/eclipse-epsilon/epsilon,12,31,Java,Eclipse Public License 2.0,"Epsilon is a family of Java-based scripting languages for automating common model-based software engineering tasks, such as code generation, model-to-model transformation and model validation, that wo","domain-specific-languages,model-based-software-engineering,model-driven-engineering"
60 | doctrine-diagram-bundle,74,2025-05-12,2021-09-21,https://github.com/jawira/doctrine-diagram-bundle,4,4,PHP,MIT License,📐 Symfony Bundle to generate database diagrams,"database,diagram,doctrine,php,symfony-bundle,uml"
61 | proto-gen-md-diagrams,68,2024-06-19,2023-02-04,https://github.com/GoogleCloudPlatform/proto-gen-md-diagrams,18,9,Go,Apache License 2.0,A utility for generating Markdown documentation for Protocol Buffers that include Mermaid UML Diagrams.,"documentation,markdown,protobuf,protocol-buffers"
62 | nvim-soil,66,2025-03-02,2023-02-02,https://github.com/javiorfo/nvim-soil,13,0,Lua,MIT License,Neovim plugin for Plant UML,"neovim,neovim-plugin,plantuml,uml"
63 | frame_transpiler,66,2025-01-19,2021-04-24,https://github.com/frame-lang/frame_transpiler,9,160,Rust,MIT License,Frame is a markdown language for creating state machines (automata) in Python as well as generating UML documentation.,"automata,cpp,csharp,frame-language,gdscript,golang,java,javascript,language,python3,rust,state-machines"
64 | plantuml,63,2025-05-13,2018-03-07,https://github.com/koppor/plantuml,12,19,TeX,LaTeX Project Public License v1.3c,A LuaLaTeX package for PlantUML in LaTeX,"latex,latex-package,lualatex,plantuml,uml"
65 | umlwriter,62,2024-12-06,2015-03-19,https://github.com/llaville/umlwriter,6,0,PHP,MIT License,Create UML class diagrams from your PHP source,"php,uml-class-diagram"
66 | use,60,2025-05-12,2020-10-09,https://github.com/useocl/use,24,19,Java,GNU General Public License v2.0,Home of the UML-based Specification Environment (USE),"modeling,ocl,uml,validation,verification"
67 | flow-lens,57,2025-05-02,2024-11-15,https://github.com/google/flow-lens,7,13,TypeScript,Apache License 2.0,"A powerful tool that transforms Salesforce Flow XML files into visual UML diagrams using PlantUML, Graphviz, or Mermaid. Visualize flow structure, highlight changes between versions with Git diff inte","flow,salesforce,uml"
68 | ocl.js,57,2025-06-02,2016-04-07,https://github.com/SteKoe/ocl.js,10,5,TypeScript,Other,The Object Constraint Language (OCL) is a language for describing rules that apply to MOF conform modelling languages like UML. The OCL is a text based language that provides constraint and object que,"constraint-language,constraints,javascript,language,ocl,ocl-expression"
69 | miros,57,2024-06-09,2017-10-10,https://github.com/aleph2c/miros,4,0,Python,No license,Python statecharts,"harel,hsm,python3,reactive-programming,state-machine,statecharts,uml,uml-state-machine"
70 | sphinx-pyreverse,52,2024-11-14,2012-10-02,https://github.com/sphinx-pyreverse/sphinx-pyreverse,18,1,Python,GNU General Public License v3.0,Simple sphinx wrapper around pyreverse (from pylint suit) to generate UML diagramms from modules.,
71 | linkml-model,52,2025-06-02,2021-03-14,https://github.com/linkml/linkml-model,20,19,Python,No license,Link Modeling Language (LinkML) model,"data-integration,data-modeling,graph-ql,json,json-schema,linked-data,linkml,metadata,metamodel,schema-language,semantic-web,shacl,shex,uml,yaml"
72 | joplin-plugin-plantUML,51,2024-07-06,2021-10-04,https://github.com/marc0l92/joplin-plugin-plantUML,8,7,TypeScript,MIT License,Render PlantUML diagram inside your Joplin notes.,
73 | webgme-hfsm,50,2025-04-29,2017-04-10,https://github.com/finger563/webgme-hfsm,18,7,C++,MIT License,"Metamodel, visualization, simulation, and code generation for Hierarchical Finite State Machines (HFSMs) following the UML State Machine spec.","code-generators,fsm,hfsm,state-machine,uml,uml-state-machine,webgme,webgme-domain"
74 |
--------------------------------------------------------------------------------
/tests/README.md:
--------------------------------------------------------------------------------
1 | # UML Tools Dashboard Tests
2 |
3 | This directory contains a streamlined test suite for the UML Tools Dashboard application with **comprehensive test files** that cover all functionality without redundancy.
4 |
5 | ## Test Files
6 |
7 | ### `test_basic_validation.py` ⭐ **Start Here**
8 | Basic validation test that runs without external dependencies:
9 | - **File structure**: Validates all required files exist
10 | - **CSV format**: Checks snapshot.csv format and content
11 | - **App structure**: Verifies app.py has required functions and imports
12 | - **Fallback logic**: Confirms fallback mechanism is implemented
13 |
14 | **Coverage:**
15 | - ✅ No external dependencies required
16 | - ✅ File structure validation
17 | - ✅ CSV data format verification
18 | - ✅ App.py structure validation
19 | - ✅ Fallback mechanism presence verification
20 |
21 | **Usage:**
22 | ```bash
23 | python tests/test_basic_validation.py
24 | ```
25 |
26 | ### `test_normal_operation.py`
27 | Comprehensive test suite for normal dashboard operation:
28 | - **Basic functionality**: File structure, imports, and dependencies
29 | - **CSV data handling**: Loading, validation, and format conversion
30 | - **Normal API operation**: Mocked successful GitHub API calls
31 | - **Integration testing**: End-to-end functionality verification
32 |
33 | **Coverage:**
34 | - ✅ File structure validation
35 | - ✅ Module imports and dependencies
36 | - ✅ CSV data loading and integrity
37 | - ✅ CSV to GitHub API format conversion
38 | - ✅ Normal GitHub API response handling
39 | - ✅ Function availability and import capability
40 |
41 | **Usage:**
42 | ```bash
43 | python tests/test_normal_operation.py
44 | ```
45 |
46 | ### `test_fallback_mechanism.py`
47 | Comprehensive test suite for the API fallback mechanism:
48 | - **Fallback triggers**: Network errors, HTTP errors, timeouts
49 | - **Data handling**: BOM handling, conversion accuracy, consistency
50 | - **User notifications**: Error messages, warnings, success confirmations
51 | - **Edge cases**: Missing files, corrupted data handling
52 |
53 | **Coverage:**
54 | - ✅ Network error fallback handling
55 | - ✅ HTTP error response fallback
56 | - ✅ Request timeout fallback
57 | - ✅ CSV BOM (Byte Order Mark) handling
58 | - ✅ Data conversion accuracy during fallback
59 | - ✅ Data consistency validation
60 | - ✅ User notification system
61 | - ✅ Edge case handling (missing files, corrupted data)
62 |
63 | **Usage:**
64 | ```bash
65 | python tests/test_fallback_mechanism.py
66 | ```
67 |
68 | ## Running Tests
69 |
70 | ### Quick Start (No Dependencies Required) ⭐
71 | For immediate validation without installing anything:
72 | ```bash
73 | cd /path/to/oss-uml-tools
74 | python tests/test_basic_validation.py
75 | ```
76 |
77 | ### Prerequisites for Full Tests
78 | Make sure you have all required dependencies installed:
79 | ```bash
80 | pip install -r requirements.txt
81 | ```
82 |
83 | ### Normal Operation Test
84 | For basic functionality verification:
85 | ```bash
86 | cd /path/to/oss-uml-tools
87 | python tests/test_normal_operation.py
88 | ```
89 |
90 | ### Fallback Mechanism Test
91 | For comprehensive fallback mechanism testing:
92 | ```bash
93 | cd /path/to/oss-uml-tools
94 | python tests/test_fallback_mechanism.py
95 | ```
96 |
97 | ### Run All Tests
98 | To run all tests:
99 | ```bash
100 | python tests/test_basic_validation.py && python tests/test_normal_operation.py && python tests/test_fallback_mechanism.py
101 | ```
102 |
103 | ## Test Architecture
104 |
105 | ### Why This Structure?
106 | The original five test files had significant overlap and redundancy. The new structure consolidates all functionality into three focused files:
107 |
108 | 1. **Basic Validation** - Quick verification without dependencies
109 | 2. **Normal Operation** - Everything that should work when the system is functioning correctly
110 | 3. **Fallback Mechanism** - Everything related to graceful degradation when the GitHub API fails
111 |
112 | ### Benefits of Consolidation
113 | - ✅ **Reduced maintenance**: Three focused files instead of five overlapping ones
114 | - ✅ **No redundancy**: Each test serves a unique purpose
115 | - ✅ **Complete coverage**: All original functionality is preserved
116 | - ✅ **Progressive complexity**: Start basic, then move to comprehensive tests
117 | - ✅ **Clearer organization**: Tests are grouped by functional area
118 | - ✅ **Faster execution**: Less duplicate test setup and teardown
119 |
120 | ## Test Coverage
121 |
122 | ### Normal Operation Tests
123 | - Basic Python module imports
124 | - Required file existence (app.py, analysis.py, requirements.txt, snapshot.csv)
125 | - CSV data integrity and format validation
126 | - Data type validation and conversion logic
127 | - Function import capability from app.py
128 | - Mocked successful GitHub API operations
129 | - Dependency availability checking
130 |
131 | ### Fallback Mechanism Tests
132 | - Network error handling and fallback triggering
133 | - HTTP error responses (403, 404, 500, 503) and fallback
134 | - Request timeout handling
135 | - CSV loading with proper BOM handling
136 | - Data conversion accuracy during fallback scenarios
137 | - Data structure consistency after fallback
138 | - User notification system (errors, warnings, info messages)
139 | - Edge cases: missing snapshot.csv, corrupted data
140 |
141 | ## Expected Behavior
142 |
143 | ### When GitHub API is Available (Normal Operation)
144 | 1. Fetch repositories from GitHub API
145 | 2. Process and filter data according to criteria
146 | 3. Display repositories in dashboard with full functionality
147 |
148 | ### When GitHub API Fails (Fallback Mechanism)
149 | 1. Detect API failure (network error, HTTP error, or timeout)
150 | 2. Display appropriate error message to user
151 | 3. Show warning about switching to snapshot data
152 | 4. Load data from `snapshot.csv` with proper BOM handling
153 | 5. Convert CSV data to GitHub API format
154 | 6. Continue normal operation with fallback data
155 | 7. Display success message about loaded snapshot data
156 |
157 | ## Test Data
158 |
159 | The tests use the `snapshot.csv` file located in the root directory. This file contains repository data in the following format:
160 |
161 | | Column | Description |
162 | |--------|-------------|
163 | | Name | Repository name |
164 | | Stars⭐ | Star count |
165 | | Last Updated | Last commit date (YYYY-MM-DD) |
166 | | First Commit | Creation date (YYYY-MM-DD) |
167 | | URL | GitHub repository URL |
168 | | Forks | Fork count |
169 | | Issues | Open issues count |
170 | | Language | Primary programming language |
171 | | License | License type |
172 | | Description | Repository description |
173 | | Topics | Comma-separated topics |
174 |
175 | ## Troubleshooting
176 |
177 | ### Common Issues
178 |
179 | 1. **Missing snapshot.csv**: Ensure the snapshot.csv file exists in the root directory
180 | 2. **Import errors**: Make sure the current working directory is the root of the project
181 | 3. **Dependency issues**: Run `pip install -r requirements.txt`
182 | 4. **Streamlit warnings**: These are expected during testing and can be ignored
183 | 5. **BOM issues**: Tests verify proper BOM handling in CSV files
184 |
185 | ### Test Failures
186 |
187 | If tests fail, check:
188 | 1. All dependencies are installed (`pip install -r requirements.txt`)
189 | 2. The snapshot.csv file exists and has the correct format
190 | 3. You're running tests from the correct directory (project root)
191 | 4. Network connectivity (for API-related tests, though they use mocks)
192 |
193 | ## Contributing
194 |
195 | When adding new tests:
196 | 1. Determine if the test belongs in **normal operation** or **fallback mechanism**
197 | 2. Add to the appropriate existing file rather than creating new files
198 | 3. Follow the existing naming convention and structure
199 | 4. Include proper docstrings and test descriptions
200 | 5. Add both positive and negative test cases where appropriate
201 | 6. Update this README if significant functionality is added
202 |
203 | The goal is to maintain comprehensive test coverage while keeping the test suite simple and maintainable with just these two focused test files.
--------------------------------------------------------------------------------
/tests/test_basic_validation.py:
--------------------------------------------------------------------------------
1 | """
2 | Basic validation test for UML Tools Dashboard.
3 | This test runs without external dependencies to verify core functionality.
4 |
5 | Usage:
6 | python tests/test_basic_validation.py
7 | """
8 |
9 | import os
10 | import sys
11 | import csv
12 |
13 | # Add parent directory to path to import app modules
14 | sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
15 |
16 | def test_required_files_exist():
17 | """Test that all required files exist."""
18 | print("Testing required files...")
19 | required_files = ['app.py', 'analysis.py', 'requirements.txt', 'snapshot.csv']
20 |
21 | all_exist = True
22 | for filename in required_files:
23 | if os.path.exists(filename):
24 | print(f"[OK] {filename} exists")
25 | else:
26 | print(f"[FAIL] {filename} missing")
27 | all_exist = False
28 |
29 | return all_exist
30 |
31 | def test_csv_basic_format():
32 | """Test basic CSV format without pandas."""
33 | print("\nTesting CSV format...")
34 | try:
35 | with open('snapshot.csv', 'r', encoding='utf-8-sig') as f:
36 | reader = csv.DictReader(f)
37 | rows = list(reader)
38 |
39 | if len(rows) == 0:
40 | print("[FAIL] No data in snapshot.csv")
41 | return False
42 |
43 | # Check required columns
44 | required_columns = ['Name', 'Stars⭐', 'URL']
45 | first_row = rows[0]
46 |
47 | for col in required_columns:
48 | if col not in first_row:
49 | print(f"[FAIL] Missing column: {col}")
50 | return False
51 |
52 | print(f"[OK] CSV contains {len(rows)} repositories")
53 | print(f"[OK] Sample: {first_row['Name']} with {first_row['Stars⭐']} stars")
54 | return True
55 |
56 | except Exception as e:
57 | print(f"[FAIL] CSV format test failed: {e}")
58 | return False
59 |
60 | def test_app_structure():
61 | """Test basic app.py structure without importing it."""
62 | print("\nTesting app.py structure...")
63 | try:
64 | with open('app.py', 'r', encoding='utf-8') as f:
65 | content = f.read()
66 |
67 | # Check for key functions and imports
68 | required_elements = [
69 | 'def fetch_uml_repos',
70 | 'import streamlit',
71 | 'import pandas',
72 | 'snapshot.csv'
73 | ]
74 |
75 | for element in required_elements:
76 | if element in content:
77 | print(f"[OK] Found: {element}")
78 | else:
79 | print(f"[FAIL] Missing: {element}")
80 | return False
81 |
82 | return True
83 |
84 | except Exception as e:
85 | print(f"[FAIL] App structure test failed: {e}")
86 | return False
87 |
88 | def test_fallback_logic_structure():
89 | """Test that fallback logic is present in app.py."""
90 | print("\nTesting fallback logic structure...")
91 | try:
92 | with open('app.py', 'r', encoding='utf-8') as f:
93 | content = f.read()
94 |
95 | # Check for fallback-related code
96 | fallback_elements = [
97 | 'api_failed',
98 | 'encoding=\'utf-8-sig\'',
99 | 'st.warning',
100 | 'st.info',
101 | 'snapshot_path'
102 | ]
103 |
104 | for element in fallback_elements:
105 | if element in content:
106 | print(f"[OK] Found fallback element: {element}")
107 | else:
108 | print(f"[FAIL] Missing fallback element: {element}")
109 | return False
110 |
111 | return True
112 |
113 | except Exception as e:
114 | print(f"[FAIL] Fallback logic test failed: {e}")
115 | return False
116 |
117 | def main():
118 | """Run all basic validation tests."""
119 | print("=" * 60)
120 | print("UML TOOLS DASHBOARD - BASIC VALIDATION")
121 | print("=" * 60)
122 | print("This test validates core functionality without external dependencies.\n")
123 |
124 | tests = [
125 | ("Required Files", test_required_files_exist),
126 | ("CSV Format", test_csv_basic_format),
127 | ("App Structure", test_app_structure),
128 | ("Fallback Logic", test_fallback_logic_structure)
129 | ]
130 |
131 | results = []
132 | for test_name, test_func in tests:
133 | print(f"\n{'-' * 50}")
134 | print(f"Running: {test_name}")
135 | print(f"{'-' * 50}")
136 | results.append(test_func())
137 |
138 | print("\n" + "=" * 60)
139 | if all(results):
140 | print("SUCCESS: ALL BASIC VALIDATION TESTS PASSED!")
141 | print("\nCore functionality is properly structured:")
142 | print("✅ All required files are present")
143 | print("✅ CSV data is formatted correctly")
144 | print("✅ App.py has the required structure")
145 | print("✅ Fallback mechanism is implemented")
146 | print("\nNext steps:")
147 | print("1. Install dependencies: pip install -r requirements.txt")
148 | print("2. Run full tests: python tests/test_normal_operation.py")
149 | print("3. Test fallback: python tests/test_fallback_mechanism.py")
150 | else:
151 | print("FAILED: SOME VALIDATION TESTS FAILED!")
152 | print("Please check the errors above and fix the issues.")
153 | print("=" * 60)
154 |
155 | return all(results)
156 |
157 | if __name__ == "__main__":
158 | main()
--------------------------------------------------------------------------------
/tests/test_fallback_mechanism.py:
--------------------------------------------------------------------------------
1 | """
2 | Comprehensive test suite for the GitHub API fallback mechanism.
3 |
4 | This module tests:
5 | 1. Fallback to snapshot.csv when API fails
6 | 2. Network error handling
7 | 3. HTTP error handling
8 | 4. Data consistency during fallback
9 | 5. User notification during fallback
10 |
11 | Usage:
12 | python tests/test_fallback_mechanism.py
13 | """
14 |
15 | import os
16 | import sys
17 | import unittest
18 | import csv
19 | from unittest.mock import patch, MagicMock
20 |
21 | # Add parent directory to path to import app modules
22 | sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
23 |
24 | class TestFallbackTriggers(unittest.TestCase):
25 | """Test conditions that trigger fallback mechanism."""
26 |
27 | @patch('requests.get')
28 | def test_network_error_triggers_fallback(self, mock_get):
29 | """Test fallback when network request fails."""
30 | # Mock network failure
31 | mock_get.side_effect = Exception("Network timeout")
32 |
33 | with patch('streamlit.error') as mock_error, \
34 | patch('streamlit.warning') as mock_warning, \
35 | patch('streamlit.info') as mock_info:
36 |
37 | from app import fetch_uml_repos
38 | repos = fetch_uml_repos(max_pages=1)
39 |
40 | # Should fall back to snapshot data
41 | self.assertGreater(len(repos), 0, "Should load repos from snapshot")
42 | self.assertIn('name', repos[0], "Repo should have correct structure")
43 |
44 | # Should show appropriate user notifications
45 | mock_error.assert_called()
46 | mock_warning.assert_called()
47 | mock_info.assert_called()
48 |
49 | print(f"[OK] Network error fallback: loaded {len(repos)} repos")
50 |
51 | @patch('requests.get')
52 | def test_http_error_triggers_fallback(self, mock_get):
53 | """Test fallback when API returns HTTP error."""
54 | # Mock HTTP error responses
55 | error_codes = [403, 404, 500, 503] # Various error conditions
56 |
57 | for error_code in error_codes:
58 | with self.subTest(error_code=error_code):
59 | mock_response = MagicMock()
60 | mock_response.status_code = error_code
61 | mock_get.return_value = mock_response
62 |
63 | with patch('streamlit.error'), \
64 | patch('streamlit.warning'), \
65 | patch('streamlit.info'):
66 |
67 | from app import fetch_uml_repos
68 | repos = fetch_uml_repos(max_pages=1)
69 |
70 | self.assertGreater(len(repos), 0,
71 | f"Should fall back on HTTP {error_code}")
72 |
73 | print("[OK] HTTP error fallback works for various error codes")
74 |
75 |
76 | class TestFallbackDataHandling(unittest.TestCase):
77 | """Test data handling during fallback operations."""
78 |
79 | def setUp(self):
80 | """Set up test fixtures."""
81 | self.snapshot_path = "snapshot.csv"
82 |
83 | def test_csv_loading_with_bom_handling(self):
84 | """Test CSV loading with proper BOM handling."""
85 | try:
86 | with open(self.snapshot_path, 'r', encoding='utf-8-sig') as f:
87 | reader = csv.DictReader(f)
88 | rows = list(reader)
89 |
90 | self.assertGreater(len(rows), 0, "Should load data")
91 | first_row = rows[0]
92 |
93 | # Check that column names don't have BOM artifacts
94 | for column in first_row.keys():
95 | self.assertNotIn('\ufeff', column,
96 | f"Column '{column}' should not contain BOM")
97 |
98 | print("[OK] CSV loading handles BOM correctly")
99 | except Exception as e:
100 | self.fail(f"BOM handling failed: {e}")
101 |
102 | def test_fallback_data_conversion_accuracy(self):
103 | """Test accuracy of CSV to API format conversion."""
104 | with open(self.snapshot_path, 'r', encoding='utf-8-sig') as f:
105 | reader = csv.DictReader(f)
106 | sample_row = next(reader)
107 |
108 | # Perform conversion
109 | repo_data = {
110 | "name": sample_row["Name"],
111 | "stargazers_count": int(sample_row["Stars⭐"]),
112 | "pushed_at": sample_row["Last Updated"] + "T00:00:00Z",
113 | "created_at": sample_row["First Commit"] + "T00:00:00Z",
114 | "html_url": sample_row["URL"],
115 | "forks": int(sample_row["Forks"]),
116 | "open_issues": int(sample_row["Issues"]),
117 | "language": sample_row["Language"] if sample_row["Language"] and sample_row["Language"] != "No language" else None,
118 | "license": {"name": sample_row["License"]} if sample_row["License"] != "No license" else None,
119 | "description": sample_row["Description"] if sample_row["Description"] != "No description" else None,
120 | "topics": sample_row["Topics"].split(",") if sample_row["Topics"] else []
121 | }
122 |
123 | # Validate conversion
124 | self.assertIsInstance(repo_data["name"], str)
125 | self.assertGreater(repo_data["stargazers_count"], 0)
126 | self.assertTrue(repo_data["html_url"].startswith("https://"))
127 | self.assertTrue(repo_data["pushed_at"].endswith("T00:00:00Z"))
128 |
129 | print("[OK] Data conversion accuracy verified")
130 |
131 | def test_data_consistency_after_fallback(self):
132 | """Test that fallback data maintains consistency with API format."""
133 | # Simulate fallback scenario
134 | with patch('requests.get', side_effect=Exception("Simulated failure")), \
135 | patch('streamlit.error'), \
136 | patch('streamlit.warning'), \
137 | patch('streamlit.info'):
138 |
139 | from app import fetch_uml_repos
140 | fallback_repos = fetch_uml_repos(max_pages=1)
141 |
142 | # Validate structure matches GitHub API format
143 | for repo in fallback_repos[:3]: # Check first 3
144 | with self.subTest(repo=repo['name']):
145 | required_fields = ['name', 'stargazers_count', 'pushed_at',
146 | 'created_at', 'html_url', 'forks', 'open_issues']
147 |
148 | for field in required_fields:
149 | self.assertIn(field, repo, f"Field '{field}' should exist")
150 |
151 | # Validate data types
152 | self.assertIsInstance(repo['stargazers_count'], int)
153 | self.assertIsInstance(repo['forks'], int)
154 | self.assertIsInstance(repo['open_issues'], int)
155 | self.assertIsInstance(repo['topics'], list)
156 |
157 | print("[OK] Data consistency maintained after fallback")
158 |
159 |
160 | class TestUserNotifications(unittest.TestCase):
161 | """Test user notification system during fallback."""
162 |
163 | @patch('requests.get')
164 | def test_fallback_notifications(self, mock_get):
165 | """Test that appropriate notifications are shown during fallback."""
166 | mock_get.side_effect = Exception("Network error")
167 |
168 | with patch('streamlit.error') as mock_error, \
169 | patch('streamlit.warning') as mock_warning, \
170 | patch('streamlit.info') as mock_info:
171 |
172 | from app import fetch_uml_repos
173 | repos = fetch_uml_repos(max_pages=1)
174 |
175 | # Check that all notification types were called
176 | mock_error.assert_called() # For API failure
177 | mock_warning.assert_called() # For fallback warning
178 | mock_info.assert_called() # For successful fallback
179 |
180 | print("[OK] User notifications work correctly during fallback")
181 |
182 |
183 | def run_integration_test():
184 | """Run integration test of the complete fallback mechanism."""
185 | print("\n" + "="*60)
186 | print("INTEGRATION TEST: GitHub API Fallback Mechanism")
187 | print("="*60)
188 |
189 | try:
190 | # Test 1: Verify snapshot exists
191 | if not os.path.exists("snapshot.csv"):
192 | raise FileNotFoundError("snapshot.csv not found")
193 |
194 | # Test 2: Test CSV loading
195 | with open("snapshot.csv", 'r', encoding='utf-8-sig') as f:
196 | reader = csv.DictReader(f)
197 | rows = list(reader)
198 | if len(rows) == 0:
199 | raise ValueError("No data in snapshot")
200 |
201 | # Test 3: Test function import
202 | from app import fetch_uml_repos
203 | if not callable(fetch_uml_repos):
204 | raise ImportError("fetch_uml_repos not callable")
205 |
206 | # Test 4: Test fallback simulation
207 | with patch('requests.get', side_effect=Exception("Simulated error")), \
208 | patch('streamlit.error'), \
209 | patch('streamlit.warning'), \
210 | patch('streamlit.info'):
211 |
212 | repos = fetch_uml_repos(max_pages=1)
213 | if len(repos) == 0:
214 | raise ValueError("Fallback returned no repositories")
215 |
216 | print(f"[OK] Snapshot contains {len(rows)} repositories")
217 | print(f"[OK] Fallback mechanism loaded {len(repos)} repositories")
218 | print("[OK] Data format conversion successful")
219 | print("\n[SUCCESS] INTEGRATION TEST PASSED!")
220 | print("Fallback mechanism is working correctly.")
221 | return True
222 |
223 | except Exception as e:
224 | print(f"\n[FAIL] INTEGRATION TEST FAILED: {e}")
225 | return False
226 |
227 |
228 | if __name__ == "__main__":
229 | # Run integration test first
230 | if run_integration_test():
231 | print("\n" + "="*60)
232 | print("RUNNING UNIT TESTS")
233 | print("="*60)
234 |
235 | unittest.main(verbosity=2, exit=False, buffer=True)
236 | else:
237 | print("Integration test failed. Please check your setup.")
238 | sys.exit(1)
--------------------------------------------------------------------------------
/tests/test_normal_operation.py:
--------------------------------------------------------------------------------
1 | """
2 | Comprehensive test suite for normal UML Tools Dashboard operation.
3 |
4 | This module tests:
5 | 1. Basic functionality and file structure
6 | 2. Dependencies and imports
7 | 3. CSV data loading and processing
8 | 4. Normal GitHub API operation (mocked)
9 | 5. Data format conversion
10 |
11 | Usage:
12 | python tests/test_normal_operation.py
13 | """
14 |
15 | import os
16 | import sys
17 | import unittest
18 | import csv
19 | from unittest.mock import patch, MagicMock
20 |
21 | # Add parent directory to path to import app modules
22 | sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
23 |
24 | class TestBasicFunctionality(unittest.TestCase):
25 | """Test basic functionality and file structure."""
26 |
27 | def test_required_files_exist(self):
28 | """Test that all required files exist."""
29 | required_files = ['app.py', 'analysis.py', 'requirements.txt', 'snapshot.csv']
30 |
31 | for filename in required_files:
32 | with self.subTest(file=filename):
33 | self.assertTrue(os.path.exists(filename), f"{filename} should exist")
34 |
35 | print("[OK] All required files exist")
36 |
37 | def test_basic_imports(self):
38 | """Test that basic Python modules can be imported."""
39 | try:
40 | import os
41 | import sys
42 | from datetime import datetime, timedelta
43 | from collections import Counter
44 | print("[OK] Basic Python modules imported successfully")
45 | except ImportError as e:
46 | self.fail(f"Failed to import basic modules: {e}")
47 |
48 | def test_app_import(self):
49 | """Test that app.py can be imported and contains required functions."""
50 | try:
51 | from app import fetch_uml_repos
52 | self.assertTrue(callable(fetch_uml_repos), "fetch_uml_repos should be callable")
53 | print("[OK] App modules imported successfully")
54 | except ImportError as e:
55 | self.fail(f"Failed to import app modules: {e}")
56 |
57 |
58 | class TestCSVDataHandling(unittest.TestCase):
59 | """Test CSV data loading and processing."""
60 |
61 | def setUp(self):
62 | """Set up test fixtures."""
63 | self.snapshot_path = "snapshot.csv"
64 |
65 | def test_csv_file_exists_and_readable(self):
66 | """Test that CSV file exists and is readable."""
67 | self.assertTrue(os.path.exists(self.snapshot_path), "snapshot.csv should exist")
68 |
69 | with open(self.snapshot_path, 'r', encoding='utf-8-sig') as f:
70 | first_line = f.readline().strip()
71 | self.assertIn('Name', first_line, "CSV should have Name column")
72 | self.assertIn('Stars⭐', first_line, "CSV should have Stars column")
73 |
74 | print("[OK] CSV file exists and is readable")
75 |
76 | def test_csv_data_integrity(self):
77 | """Test CSV data format and content."""
78 | required_columns = ['Name', 'Stars⭐', 'Last Updated', 'First Commit',
79 | 'URL', 'Forks', 'Issues', 'Language', 'License',
80 | 'Description', 'Topics']
81 |
82 | with open(self.snapshot_path, 'r', encoding='utf-8-sig') as f:
83 | reader = csv.DictReader(f)
84 | rows = list(reader)
85 |
86 | self.assertGreater(len(rows), 0, "CSV should contain repository data")
87 |
88 | first_row = rows[0]
89 | for col in required_columns:
90 | self.assertIn(col, first_row, f"Column '{col}' should exist")
91 |
92 | # Validate data types and formats
93 | self.assertIsInstance(first_row['Name'], str)
94 | self.assertTrue(first_row['URL'].startswith('https://github.com/'))
95 |
96 | print(f"[OK] CSV contains {len(rows)} repositories with correct format")
97 |
98 | def test_csv_to_api_conversion(self):
99 | """Test conversion of CSV data to GitHub API format."""
100 | with open(self.snapshot_path, 'r', encoding='utf-8-sig') as f:
101 | reader = csv.DictReader(f)
102 | sample_row = next(reader)
103 |
104 | # Convert to API format (same logic as in app.py)
105 | repo_data = {
106 | "name": sample_row["Name"],
107 | "stargazers_count": int(sample_row["Stars⭐"]),
108 | "pushed_at": sample_row["Last Updated"] + "T00:00:00Z",
109 | "created_at": sample_row["First Commit"] + "T00:00:00Z",
110 | "html_url": sample_row["URL"],
111 | "forks": int(sample_row["Forks"]),
112 | "open_issues": int(sample_row["Issues"]),
113 | "language": sample_row["Language"] if sample_row["Language"] and sample_row["Language"] != "No language" else None,
114 | "license": {"name": sample_row["License"]} if sample_row["License"] != "No license" else None,
115 | "description": sample_row["Description"] if sample_row["Description"] != "No description" else None,
116 | "topics": sample_row["Topics"].split(",") if sample_row["Topics"] else []
117 | }
118 |
119 | # Validate converted structure
120 | self.assertIsInstance(repo_data["name"], str)
121 | self.assertIsInstance(repo_data["stargazers_count"], int)
122 | self.assertIsInstance(repo_data["topics"], list)
123 | self.assertTrue(repo_data["pushed_at"].endswith("T00:00:00Z"))
124 |
125 | print(f"[OK] CSV to API conversion works: {repo_data['name']}")
126 |
127 |
128 | class TestNormalAPIOperation(unittest.TestCase):
129 | """Test normal GitHub API operation with mocks."""
130 |
131 | def setUp(self):
132 | """Set up test fixtures."""
133 | self.test_repo_data = {
134 | "name": "test-uml-tool",
135 | "stargazers_count": 150,
136 | "pushed_at": "2023-12-01T00:00:00Z",
137 | "created_at": "2023-01-01T00:00:00Z",
138 | "html_url": "https://github.com/test/test-uml-tool",
139 | "forks": 25,
140 | "open_issues": 3,
141 | "language": "Java",
142 | "license": {"name": "MIT License"},
143 | "description": "A test UML tool",
144 | "topics": ["uml", "diagrams", "modeling"]
145 | }
146 |
147 | @patch('requests.get')
148 | def test_successful_api_call(self, mock_get):
149 | """Test successful GitHub API response."""
150 | # Mock successful API response
151 | mock_response = MagicMock()
152 | mock_response.status_code = 200
153 | mock_response.json.return_value = {
154 | "items": [self.test_repo_data]
155 | }
156 | mock_get.return_value = mock_response
157 |
158 | with patch('streamlit.error'), patch('streamlit.warning'), patch('streamlit.info'):
159 | from app import fetch_uml_repos
160 | repos = fetch_uml_repos(max_pages=1)
161 |
162 | self.assertGreater(len(repos), 0, "Should return repositories")
163 | self.assertEqual(repos[0]["name"], "test-uml-tool")
164 | self.assertEqual(repos[0]["stargazers_count"], 150)
165 |
166 | print("[OK] Normal API operation works correctly")
167 |
168 |
169 | class TestDependencies(unittest.TestCase):
170 | """Test required dependencies availability."""
171 |
172 | def test_optional_dependencies(self):
173 | """Test optional dependencies with graceful handling."""
174 | optional_modules = {
175 | 'pandas': 'Required for CSV processing',
176 | 'requests': 'Required for API calls',
177 | 'streamlit': 'Required for web interface',
178 | 'plotly': 'Required for charts'
179 | }
180 |
181 | missing_modules = []
182 | for module, purpose in optional_modules.items():
183 | try:
184 | __import__(module)
185 | print(f"[OK] {module} is available")
186 | except ImportError:
187 | missing_modules.append(f"{module} ({purpose})")
188 |
189 | if missing_modules:
190 | print(f"[WARNING] Missing optional modules: {', '.join(missing_modules)}")
191 | print("[INFO] App will use fallback mechanisms")
192 | else:
193 | print("[OK] All dependencies are available")
194 |
195 |
196 | def run_integration_test():
197 | """Run integration test to verify overall functionality."""
198 | print("\n" + "="*60)
199 | print("INTEGRATION TEST: UML Tools Dashboard Normal Operation")
200 | print("="*60)
201 |
202 | try:
203 | # Test basic file structure
204 | required_files = ['app.py', 'analysis.py', 'snapshot.csv']
205 | for file in required_files:
206 | if not os.path.exists(file):
207 | raise FileNotFoundError(f"Required file {file} not found")
208 |
209 | # Test CSV loading
210 | with open('snapshot.csv', 'r', encoding='utf-8-sig') as f:
211 | reader = csv.DictReader(f)
212 | rows = list(reader)
213 | if len(rows) == 0:
214 | raise ValueError("No data in snapshot.csv")
215 |
216 | # Test function import
217 | from app import fetch_uml_repos
218 | if not callable(fetch_uml_repos):
219 | raise ImportError("fetch_uml_repos is not callable")
220 |
221 | print(f"[OK] Found {len(rows)} repositories in snapshot")
222 | print("[OK] All core functionality verified")
223 | print("\n[SUCCESS] INTEGRATION TEST PASSED!")
224 | print("Normal operation is working correctly.")
225 | return True
226 |
227 | except Exception as e:
228 | print(f"\n[FAIL] INTEGRATION TEST FAILED: {e}")
229 | return False
230 |
231 |
232 | if __name__ == "__main__":
233 | # Run integration test first
234 | if run_integration_test():
235 | print("\n" + "="*60)
236 | print("RUNNING UNIT TESTS")
237 | print("="*60)
238 |
239 | unittest.main(verbosity=2, exit=False, buffer=True)
240 | else:
241 | print("Integration test failed. Please check your setup.")
242 | sys.exit(1)
--------------------------------------------------------------------------------