Giter VIP home page Giter VIP logo

seldom-platform's People

Contributors

alleyhe1987 avatar alphadog9 avatar defnngj avatar klookapptest avatar patrickhxh avatar yongchin0821 avatar

Stargazers

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

Watchers

 avatar  avatar

seldom-platform's Issues

【Bug】

场景1:当同步用例后,去任务管理运行,会出现卡住的现象

场景2:当任务管理页运行后,去操作同步用例,会出现报错的问题

Traceback (most recent call last):
  File "C:\Users\huawei\AppData\Local\Programs\Python\Python311\Lib\site-packages\ninja\operation.py", line 107, in run
    result = self.view_func(request, **values)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\PythonAbout\test_platform\backend\app_project\api.py", line 195, in sync_project_case
    main_extend = TestMainExtend(path=test_dir)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\huawei\AppData\Local\Programs\Python\Python311\Lib\site-packages\seldom\running\runner.py", line 275, in __init__
    super().__init__(path=path, browser=browser, base_url=base_url, debug=debug, timeout=timeout,
  File "C:\Users\huawei\AppData\Local\Programs\Python\Python311\Lib\site-packages\seldom\running\runner.py", line 164, in __init__
    self.TestSuits = seldomTestLoader.rediscover(self.path)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\huawei\AppData\Local\Programs\Python\Python311\Lib\site-packages\seldom\running\loader_extend.py", line 165, in rediscover
    tests = list(self._find_tests(start_dir, pattern))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\huawei\AppData\Local\Programs\Python\Python311\Lib\unittest\loader.py", line 377, in _find_tests
    tests, should_recurse = self._find_test_path(full_path, pattern)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\huawei\AppData\Local\Programs\Python\Python311\Lib\unittest\loader.py", line 429, in _find_test_path
    raise ImportError(
ImportError: 'test_rdsAPIAverageExecutionTimeOfQueryTasks' module incorrectly imported from 'D:\\PythonAbout\\test_platform\\backend\\github\\inter-fave-auto-test_temp\\test_dir'. Expected 'D:\\PythonAbout\\test_platform\\backend\\github\\inter-fave-auto-test\\test_dir'. Is this module globally installed?
Internal Server Error: /api/project/1/sync_case

runner.py文件中 run()方法为什么不把执行结果返回呢?

文件地址:running.runner.py
个人认为好处:
1、可以针对结果进行分析统计
2、针对返回结果进行二次策略性调用
3、主要添加返回结果:result=runner.run(suits)

改过的一系列方法:含关联文件
def run(self, suits) -> None:
"""
run test case
"""
if self.debug is False:
for filename in os.listdir(os.getcwd()):
if filename == "reports":
break
else:
os.mkdir(os.path.join(os.getcwd(), "reports"))

        if (self.report is None) and (BrowserConfig.REPORT_PATH is not None):
            report_path = BrowserConfig.REPORT_PATH
        else:
            report_path = BrowserConfig.REPORT_PATH = os.path.join(os.getcwd(), "reports", self.report)

        with open(report_path, 'wb') as fp:
            if report_path.split(".")[-1] == "xml":
                runner = XMLTestRunner(output=fp, logger=log_cfg)
                result=runner.run(suits)
            else:
                runner = HTMLTestRunner(stream=fp, title=self.title, tester=self.tester,
                                        description=self.description,
                                        language=self.language, blacklist=self.blacklist, whitelist=self.whitelist,
                                        logger=log_cfg)
                result=runner.run(suits, rerun=self.rerun, save_last_run=self.save_last_run)

        log.success(f"generated html file: file:///{report_path}")
        log.success(f"generated log file: file:///{BrowserConfig.LOG_PATH}")
        if self.open is True:
            webbrowser.open_new(f"file:///{report_path}")
    else:
        runner = DebugTestRunner(
            blacklist=self.blacklist,
            whitelist=self.whitelist,
            verbosity=2)
        result=runner.run(suits)

    log.success(f"A1 run the test in debug mode without generating HTML report!\n{result}")
    return result

字典树的实现

# 字典树
import json


class TrieTree:

    def __init__(self):
        self.root = {}

    def insert(self, item):
        current_node = self.root
        for _item in item:
            node = current_node.get(_item)
            if node is None:
                new_node = {}
                current_node[_item] = new_node
                current_node = new_node
            else:
                current_node = node
        current_node["is_file"] = True


trie_tree = TrieTree()
trie_tree.insert(item=["test_dmo.py"])
trie_tree.insert(item=["base_case", "test_001_from.py"])
trie_tree.insert(item=["base_case", "test_002_link.py"])
trie_tree.insert(item=["base_case", "test_003_iframe.py"])
trie_tree.insert(item=["more_case", "test_004_window.py"])
trie_tree.insert(item=["more_case", "test_005_ddt.py"])
trie_tree.insert(item=["more_case", "test_006_file_ddt.py"])

print(json.dumps(trie_tree.root, indent=2, ensure_ascii=False))

运行结果:

{
  "test_dmo.py": {
    "is_file": true
  },
  "base_case": {
    "test_001_from.py": {
      "is_file": true
    },
    "test_002_link.py": {
      "is_file": true
    },
    "test_003_iframe.py": {
      "is_file": true
    }
  },
  "more_case": {
    "test_004_window.py": {
      "is_file": true
    },
    "test_005_ddt.py": {
      "is_file": true
    },
    "test_006_file_ddt.py": {
      "is_file": true
    }
  }
}

点击测试报告后端报错

get_queryset() got an unexpected keyword argument 'task_id'
Traceback (most recent call last):
File "E:\Software\Python37\lib\site-packages\ninja\operation.py", line 104, in run
result = self.view_func(request, **values)
File "E:\Software\Python37\lib\site-packages\ninja\pagination.py", line 140, in view_with_pagination
items = func(*args, **kwargs)
File "F:\seldom-platform\backend\app_task\api.py", line 188, in get_report_list
return TaskReport.objects.get_queryset(task_id=task_id).order_by("-create_time")[:1000]
TypeError: get_queryset() got an unexpected keyword argument 'task_id'

需要修改get_report_list 方法对应return中调用的方法
image

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.