models.py 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. from django.db import models
  2. # Create your models here.
  3. from apps.plan.models import TestPlan
  4. from apps.software.models import Software
  5. from apps.user.models import User
  6. class TestTask(models.Model):
  7. id = models.CharField(max_length=128, unique=True, primary_key=True, verbose_name='测试任务编号',
  8. default='TestLaboratory_V1_Task_1')
  9. title = models.CharField(max_length=50, verbose_name='测试任务标题')
  10. executor = models.ForeignKey(User, null=True, on_delete=models.CASCADE, verbose_name='测试任务执行者')
  11. # 0: 发布,release;(此阶段可以上传未执行的测试用例)1:执行测试用例,execute(此阶段需上传包含测试结果的测试用例);2:执行完成
  12. state = models.IntegerField(verbose_name='测试任务状态')
  13. type = models.CharField(max_length=30, default='other', verbose_name='测试任务类型')
  14. description = models.TextField(verbose_name='测试任务描述')
  15. plan = models.ForeignKey(TestPlan, on_delete=models.CASCADE, verbose_name='测试任务所属计划')
  16. statement_file = models.TextField(verbose_name='说明文档id文件')
  17. case_file = models.TextField(null=True, verbose_name='测试用例文档')
  18. case_all = models.IntegerField(null=True, verbose_name='全部测试用例数量')
  19. case_not_execute = models.IntegerField(null=True, verbose_name='未执行测试用例数量')
  20. case_success = models.IntegerField(null=True, verbose_name='成功测试用例数量')
  21. case_fail = models.IntegerField(null=True, verbose_name='失败测试用例数量')
  22. create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
  23. update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间')
  24. delete = models.BooleanField(default=False)
  25. def __str__(self):
  26. return self.title
  27. class Meta:
  28. verbose_name = '测试任务'
  29. verbose_name_plural = verbose_name
  30. db_table = 'task'
  31. class TestCase(models.Model):
  32. id = models.CharField(max_length=128, unique=True, primary_key=True, verbose_name='测试用例编号',
  33. default='TestLaboratory_V1_Case_1')
  34. task = models.ForeignKey(TestTask, on_delete=models.CASCADE, verbose_name='测试用例所在测试任务',
  35. default='TestLaboratory_V1_Task_1')
  36. id_in_task = models.CharField(max_length=30, verbose_name='在测试任务中编号', default='1')
  37. software = models.ForeignKey(Software, null=True, on_delete=models.CASCADE, verbose_name='测试软件')
  38. executor_id = models.ForeignKey(User, null=True, on_delete=models.CASCADE, verbose_name='执行者id')
  39. version = models.CharField(max_length=30, null=True, verbose_name='软件版本')
  40. name = models.CharField(max_length=50, verbose_name='名称')
  41. state = models.IntegerField(verbose_name='状态')
  42. writer = models.CharField(max_length=30, verbose_name='测试用例编写人', null=True)
  43. executor = models.CharField(max_length=30, verbose_name='测试用例执行人', null=True)
  44. assessor = models.CharField(max_length=30, verbose_name='测试用例评审员', null=True)
  45. requisite = models.TextField(null=True, verbose_name='前置条件')
  46. priority = models.CharField(max_length=10, null=True, verbose_name='优先级')
  47. environment = models.TextField(null=True, verbose_name='测试环境')
  48. type = models.CharField(max_length=30, null=True, verbose_name='测试类型')
  49. process = models.TextField(verbose_name='测试步骤')
  50. expected_result = models.TextField(verbose_name='预期结果')
  51. actual_result = models.TextField(verbose_name='实际结果', null=True)
  52. create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
  53. update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间')
  54. delete = models.BooleanField(default=False)
  55. remark = models.TextField(null=True, verbose_name='备注')
  56. def __str__(self):
  57. return self.name
  58. class Meta:
  59. verbose_name = '测试用例'
  60. verbose_name_plural = verbose_name
  61. db_table = 'test_case'
  62. class BeidouCase(models.Model):
  63. id = models.CharField(max_length=128, unique=True, primary_key=True, verbose_name='测试用例编号',
  64. default='TestLaboratory_V1_BeidouCase_1')
  65. task = models.ForeignKey(TestTask, on_delete=models.CASCADE, verbose_name='测试用例所在测试任务',
  66. default='TestLaboratory_V1_Task_1')
  67. software = models.ForeignKey(Software, null=True, on_delete=models.CASCADE, verbose_name='测试软件')
  68. executor = models.ForeignKey(User, null=True, on_delete=models.CASCADE, verbose_name='执行者id')
  69. version = models.CharField(max_length=30, null=True, verbose_name='软件版本')
  70. title = models.CharField(max_length=50, verbose_name='测试用例名称')
  71. state = models.IntegerField(verbose_name='状态', default=0)
  72. positioning_accuracy = models.FloatField(null=True, verbose_name='定位精度')
  73. timing_accuracy = models.FloatField(null=True, verbose_name='定时精度')
  74. pseudo_range_measurement_accuracy = models.FloatField(null=True, verbose_name='伪距测量精度')
  75. carrier_measurement_accuracy = models.FloatField(null=True, verbose_name='载波测量精度')
  76. speed_measurement_accuracy = models.FloatField(null=True, verbose_name='测速精度')
  77. sensitivity_capture = models.FloatField(null=True, verbose_name='捕获灵敏度')
  78. receiving_sensitivity = models.FloatField(null=True, verbose_name='接受灵敏度')
  79. sensitivity_track = models.FloatField(null=True, verbose_name='跟踪灵敏度')
  80. power_range_low = models.FloatField(null=True, verbose_name='接收功率范围下界')
  81. power_range_high = models.FloatField(null=True, verbose_name='接收功率范围上界')
  82. self_integrity = models.FloatField(null=True, verbose_name='自主完好性')
  83. system_integrity = models.FloatField(null=True, verbose_name='系统完好性')
  84. capture_time = models.FloatField(null=True, verbose_name='首次捕获时间')
  85. recapture_time = models.FloatField(null=True, verbose_name='失锁重捕时间')
  86. update_rate = models.FloatField(null=True, verbose_name='定位测速更新率')
  87. trace_channels = models.IntegerField(null=True, verbose_name='跟踪通道数')
  88. max_velocity = models.FloatField(null=True, verbose_name='最大速度')
  89. max_acceleration = models.FloatField(null=True, verbose_name='最大加速度')
  90. create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
  91. update_time = models.DateTimeField(auto_now=True, verbose_name='修改时间')
  92. delete = models.BooleanField(default=False)
  93. remark = models.TextField(null=True, verbose_name='备注')
  94. def __str__(self):
  95. return self.title
  96. class Meta:
  97. verbose_name = '北斗测试用例'
  98. verbose_name_plural = verbose_name
  99. db_table = 'beidou_case'