Giter Club home page Giter Club logo

munit's People

Contributors

cousinmi68 avatar dan-vitry-ge avatar fupglobema avatar ge-timothy-chueh avatar gedanieldutoit avatar gepaulwarwicker avatar geprzemyslawwagner avatar hanousige avatar jun1111 avatar kickaha2017 avatar ollie-sims avatar paulwarwicker avatar robertdebenham avatar ulinaedelin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

munit's Issues

How to define setup/teardown for suites / run sessions with munit ?

MUnit tests often requires time consuming preparation ( e.g. starting an application, create design), which not all test cases want to do each time in their setup. Same situation exist for cleanups ( close applications, delete designs) and test case teardown.

Other frameworks like pytest allows to define not only for the test itself a setup / teardown, even for suites and run sessions pytest - Fixture scopes

Question is, which concept has MUnit for this?

Checking the one_time_set_up() and one_time_tear_down() functions shows, that these steps are not executed in each run. It requires that a run with other test classes are executed before or afterwards.

  • one_time_tear_down() is only executed, when another test class is running afterwards
  • one_time_set_up() is only executed, when another test class is running afterwards
  • sample code see one_time_munit_samples.magik
MagikSF> one_time_munit_sample_01.run()
$
one_time_munit_sample_01.one_time_set_up()
one_time_munit_sample_01.set_up()
test_sample_1()
one_time_munit_sample_01.tear_down()
one_time_munit_sample_01.set_up()
test_sample_3()
one_time_munit_sample_01.tear_down()
a sw:mtest_result 
MagikSF> one_time_munit_sample_01.run()
$
one_time_munit_sample_01.set_up()
test_sample_1()
one_time_munit_sample_01.tear_down()
one_time_munit_sample_01.set_up()
test_sample_3()
one_time_munit_sample_01.tear_down()
a sw:mtest_result 
MagikSF> one_time_munit_sample_02.run()
$
one_time_munit_sample_01.one_time_tear_down()
one_time_munit_sample_02.one_time_set_up()
one_time_munit_sample_02.set_up()
test_sample_2()
one_time_munit_sample_02.tear_down()
one_time_munit_sample_02.set_up()
test_sample_4()
one_time_munit_sample_02.tear_down()
a sw:mtest_result 
MagikSF> one_time_munit_sample_01.run()
$
one_time_munit_sample_02.one_time_tear_down()
one_time_munit_sample_01.one_time_set_up()
one_time_munit_sample_01.set_up()
test_sample_1()
one_time_munit_sample_01.tear_down()
one_time_munit_sample_01.set_up()
test_sample_3()
one_time_munit_sample_01.tear_down()
a sw:mtest_result 

Report error contents in traceback slot

When there is an error, the error string is appended to the test name in the top right box. You cannot see the complete error. Can you add the contents to the traceback text? Proposed solution below.
image

_pragma(classify_level=restricted,topic=MUnit)
_private _method test_failure.init_traceback_text()
	## Init slot .traceback_text.
	#DEBUG show(:test_failure,:|init_traceback_text()|)

	_global !traceback!

	_try _with error_variable
		a_stream << internal_text_output_stream.new()
		!traceback!( a_stream, _unset, _false )
		a_traceback_text << a_stream.string
		_if ( tb << .raised_condition[:traceback] ) _isnt _unset
		_then
			a_traceback_text << "".concatenation( tb, a_traceback_text )
		_endif
		a_traceback_text << a_traceback_text.slice( a_traceback_text.index_of(%-),
							    a_traceback_text.size )
		.traceback_text << a_traceback_text
	_when error
		_if .traceback_text _is _unset
		_then
			.traceback_text << write_string( "Error getting traceback text ",
							 " running on the ", _thisthread.name,
							 " thread", newline_char,
							 error_variable.report_contents_string,
							 a_stream.string )
		_endif
	_endtry
	# START CHANGE (2022/08/18 M Field (FCSI)) : 
	# record the error contents as well in traceback_text
	_if .raised_condition _isnt _unset 
	_then
		.traceback_text << .raised_condition.report_string +
						   %newline + .traceback_text
	_endif
	# END CHANGE (2022/08/18 mf)
	
_endmethod
$

Method Conflicts on munit_test_case

munit_test_case may be deprecated but recent changes broke it unnecessarily.

In particular the changes left a number of unresolved conflict methods on munit_test_case.

Please resolve the conflicts.

The conflict details:

print_conflict_methods(munit_test_case)
$
method assert_true() *** conflict(assert munit_assert ) *** assert_true() in munit_test_case
method assert_unset() *** conflict(munit_assert assert ) *** assert_unset() in munit_test_case
method assert_not_unset() *** conflict(assert munit_assert ) *** assert_not_unset() in munit_test_case
method assert_is() *** conflict(assert munit_assert ) *** assert_is() in munit_test_case
method assert_is_not() *** conflict(munit_assert assert ) *** assert_is_not() in munit_test_case

Loading module munit_logging breaks munit

Module munit_logging breaks munit when the system temp directory is set to anything other than appdata/local/temp .

Steps to reproduce:

  • Set environment variable "TEMP" (in the traceback below "c:/windows/temp")
  • Load module munit_logging
  • Run any testcase
  • Traceback:
**** Error: Access denied to c:\windows\Smallworld\munit_log.json
     file_no_access(function="open file", filename="c:\windows\Smallworld\munit_log.json")

---- traceback: Alchemy-REPL (light_thread 26381049) ----
time=20/07/2019 20:28:25
sw!version=5.2.0.0 (swaf)
os_text_encoding=cp1252
!snapshot_traceback?!=unset

condition.raise()            (sys_src/guts/condition.magik:616)
system.file_error()            (sys_src/guts/system.magik:1425)
system.prim()            (sys_src/guts/system.magik:1753)
system.sys!open_file_output()            (sys_src/guts/system.magik:633)
external_text_simple_output_stream.new_appending()            (sys_src/streams_external/external_text_simple_output_stream.magik:47)
simple_file_log.new_file_appending()            (modules/sw_core/logging/source/simple_file_log.magik:61)
munit_log.new_json_log()            (modules\munit_logging\source\munit_log.magik:134)
munit_log.new_json_logging_framework()            (modules\munit_logging\source\munit_log.magik:113)
munit_log.get_logger()            (modules\munit_logging\source\munit_log.magik:95)

Responsible code:

_pragma(classify_level=restricted, usage={redefinable}, topic={logging})
## Defines the filename and path for the migration log
munit_log.define_shared_constant(:log_filepath,
	system.pathname_down(
		system.pathname_down(system.pathname_up(system.temp_directory_name), "Smallworld"),
		"munit_log.json"),	
	:private)
$

Proposed fix:

_pragma(classify_level=restricted, usage={redefinable}, topic={logging})
## Defines the filename and path for the migration log
munit_log.define_shared_constant(:log_filepath,
	system.temp_file_name("munit_log.json"),
	:private)
$

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.